You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Derek Jones edited this page Jul 5, 2012
·
5 revisions
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.