-
Notifications
You must be signed in to change notification settings - Fork 0
Problem with allowed types in upload class
I ran into an problem with allowed types in upload class. When I set into allowed types images and other files (like this 'gif|jpg|jpeg|png|iso|dmg|zip|rar|doc|docx|xls|xlsx|ppt|pptx|csv|ods|odt|odp|pdf|rtf|sxc|sxi|txt|exe|avi|mpeg|mp3|mp4|3gp') and if I want upload for example AVI them I get error about not allowed file type.
I looked into Upload class, specifically is_allowed_filetype method. I found that this method inspecting what getimagesize returns although file isnt image.
There are two solutions:
-
rewrite allowed types so that images extensions will be at the end ('iso|dmg|zip|rar|doc|docx|xls|xlsx|ppt|pptx|csv|ods|odt|odp|pdf|rtf|sxc|sxi|txt|exe|avi|mpeg|mp3|mp4|3gp|gif|jpg|jpeg|png')
-
download my corrected file MY_Upload class - I added one "if", that check file_type by calling method is_image.