So, after the new WP updates my form will not allow certain files to upload. I have a Gravity form with an upload field to submit 3D print files. I can get one type of file to work, but not the others. Just hoping someone else has had this issue and has some update on a solution.
I'm using:
add_filter('upload_mimes','add_custom_mime_types',1,1);
function add_custom_mime_types($mime_types){
$mime_types['stl'] = 'application/wavefront-stl';
$mime_types['igs'] = 'application/iges';
$mime_types['stp'] = 'application/step';
$mime_types['step'] = 'application/step';
return $mime_types;
}
Oddly, the .stl will upload but not the others. I have also installed Extra File Types plugin to add file types but no help there. Disable Real MIME Check did not work either.
I also added:
define( 'ALLOW_UNFILTERED_UPLOADS', true );
to wp-config and I can upload these files to the media library as an admin, but I need them to upload from my front-end form.
wp_enqueue_media();
and also initialized the js uploaded`. Note that if you want your users to be able to upload, then you still need to give them the 'upload_files' capability as well.wp_handle_upload_prefilter
filter and see the response you get.wp_handle_upload_prefilter
.