I am with the strangest issue here. There is a writer here on my website, using WordPress 4.2.2 (but it happens for months) that keeps uploading photos with names such as ())
, 00
without even an extension and for some dark reason, these images bypass the WordPress upload filter and get crazy names such as simply jpg
or jpg4
.
The mess is even bigger when we use our image resize system that ends creating images with names such as jpg12-250x100.
(note the trailing dot).
So our CloudFlare cache breaks, the internal cache breaks and to finish up this teenager's bedroom, I am not able to reproduce this error even with superuser access. I already checked his user and he doesn't have the role to unfiltered_upload
.
I don't know even how to start this investigation because I can't do it with my account. Is there any filter at the WordPress' upload system that I can search across my plugins to isolate the suspect code? I am totally blind right now.
Thanks, Vinicius.
If you want to allow a user to upload an external file to your website, you need to use a file upload box, also known as a file select box. This is also created using the <input> element but type attribute is set to file.
The image upload issue in WordPress is typically caused by incorrect file permissions. Your WordPress files are stored on your web hosting server and need specific file and directory permissions to work. Wrong file permissions prevent WordPress from reading or uploading file on the hosting server.
You can check wp_check_filetype_and_ext
to check the filetype and proper extension.
Reference: https://codex.wordpress.org/Function_Reference/wp_check_filetype_and_ext
You can use wp_handle_upload
hook to process uploaded file, similar to:
https://wordpress.stackexchange.com/a/38585
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With