Modify and add the problem that WP upload file type failed to upload
The default configuration of WP supports some common file types, but some file types that are not set by default cannot be uploaded, and we can configure to allow uploading the file types that we need to upload. I will test and upload the ZB plug-in package. zba, and the file type of PHP upload files is application/octet stream, and then add add_filter to the WP theme or plug-in
add_filter('upload_mimes', 'custom_upload_mimes'); function custom_upload_mimes($existing_mimes=array()) { //Add file types that support uploading $existing_mimes['zba']='application/octet-stream'; return $existing_mimes; }
$finfo = finfo_open( FILEINFO_MIME_TYPE ); $real_mime = finfo_file( $finfo, $file ); finfo_close( $finfo );
add_filter('upload_mimes', 'custom_upload_mimes'); function custom_upload_mimes($existing_mimes=array()) { //Add file types that support uploading $existing_mimes['zba']='application/xml'; return $existing_mimes; }