Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

FIXED Upload Problems: image.JPG fails - image.jpg works...


Reply


6 Posts   2162 Views

Avatar
Futureweb

Community Member, 233 Posts

1 February 2011 at 8:40pm

Hello,

I notice this bug was reported ages ago (http://silverstripe.org/archive/show/2466), but i'm having the same issue.

When I upload jpeg images, and the extension is in uppercase, the image cannot be viewed (403 Forbidden server error)

Did anyone ever find a fix for this?
If i rename the extension of the uploaded file, it works, so i'm thinking it must be a .htaccess / redirect problem or something - not an upload problem?

example
http://silverstripe.northernlightsdesign.co.uk/assets/Uploads/bike2.JPG
http://silverstripe.northernlightsdesign.co.uk/assets/Uploads/bike.jpg

Avatar
Futureweb

Community Member, 233 Posts

1 February 2011 at 8:45pm

Ok, just after I posted this, i took another look at the folder, and noticed another .htaccess file in the 'assets' folder

In here, it gives a list of permissible files - so I just had to add JPG into the list.

<FilesMatch "\.(JPG|html|htm|xhtml|js|css|bmp|png|gif|jpg|jpeg|ico|pcx|tif|tiff|au|mid|midi|mpa|mp3|ogg|m4a|ra|wma|wav|cda|avi|mpg|mpeg|asf|wmv|m4v|mov|mkv|mp4|swf|flv|ram|rm|doc|docx|txt|rtf|xls|xlsx|pages|ppt|pptx|pps|csv|cab|arj|tar|zip|zipx|sit|sitx|gz|tgz|bz2|ace|arc|pkg|dmg|hqx|jar|xml|pdf)$">
   Allow from all
</FilesMatch>

JPG files are pretty common, so hopefully this fix can help others!

Avatar
tmkp

Community Member, 42 Posts

3 February 2011 at 9:36am

Bless you Jon,
you just saved the day over here.
This really should be rolled in, or handled differently altogether. Maybe automatically lowercasing file extensions extension on upload?
Most of the clients i work for haven't even seen a file extension in their lives.
Thanks a bunch again,
Andi

Avatar
brandstudionz

Community Member, 3 Posts

18 February 2011 at 11:48am

Legend Thanks!

Avatar
PeterNL

Community Member, 9 Posts

31 May 2011 at 4:44am

Thanks for sharing your answer :)

Avatar
SSadmin

Community Member, 90 Posts

1 June 2011 at 11:48am

Thanks for sharing.
It would be good if raise a ticket for silverstripe core development team.
Maybe it worthwhile putting the code in their ss package.