Sauter la navigation

[Résolu] File not uploading

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

Add more allowed mime types and file extensions for Toolset form file field.

Solution:

It needs custom codes, for example:
https://toolset.com/forums/topic/file-not-uploading/#post-1136546

Relevant Documentation:

https://developer.wordpress.org/reference/hooks/upload_mimes/

This support ticket is created Il y a 6 années et 2 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Ce sujet contient 5 réponses, a 2 voix.

Dernière mise à jour par Luo Yang Il y a 6 années et 1 mois.

Assisté par: Luo Yang.

Auteur
Publications
#1128352
Screen Shot 2018-10-16 at 9.45.07 AM.png
Screen Shot 2018-10-16 at 9.44.46 AM.png

I am trying to: Upload a file

Link to a page where the issue can be seen: lien caché

I expected to see: A file uploaded

Instead, I got: You cannot upload that file error

The files are uploading to the library fine but not in the cred form

#1128841

Hello,

Please provide more details for the question:
What kind of file type do you want to upload?
Are you using other custom codes/plugin to let it allow to upload in admin side library?

I need to duplicate the same problem and test it in my localhost, thanks

#1136122

I would like to upload a .stl.

I used a php function

function my_custom_upload_mimes($mimes = array()) {
 
  // Add a key and value for the jfif file type
  $mimes['stl'] = "application/wavefront-stl";
 
  return $mimes;
}
 
add_action('upload_mimes', 'my_custom_upload_mimes');
#1136546

Thanks for the details, please try to modify your codes as below:

...
add_filter('upload_mimes', 'my_custom_upload_mimes');

And test again.

More help:
https://developer.wordpress.org/reference/hooks/upload_mimes/

#1136939

My issue is resolved now. Thank you!

#1137196

You are welcome