In my site, I give an option to upload images with .jpg and .JPG extension. They both work and I can see both o开发者_运维技巧n the server itself.
When I try to see in the browser the photos with the .jpg extension by calling them name.jpg, they work. When I call to the othername.JPG (which is called that way on the server) it does not work and does not show it. othername.jpg does not work too.
I suppose your web server is not configured to send the Content-Type: image/jpeg
HTTP header for such files. It's possible that some browsers refuse to display them as pictures if the MIME type does not match. If you happen to be using Apache, you can fix it yourself in an .htaccess
file:
AddType image/jpeg .JPG
You should also consider that you cannot count of URLs being case-insensitive: FOO can equal foo... or not. Use always the exact case and save yourself future problems.
Edit:
Before misconfiguring random stuff, you can follow this checklist and see what fails exactly:
- Is the URL valid?
Foo.jpg
is not the same asfoo.jpg
. - Does the browser receive the file? Firebug should tell you.
- What's the HTTP response code? Firebug should tell you.
- What's the
Content-Type
header? Firebug should tell you.
Common status codes:
404
: the file could not be found. Most likely, your URL is wrong.403
: you are not authorised to see the file. It can be a permissions issue.500
: generic server error code. You should open your hosting service control panel and have a look at the error log.
Your using linux/apache right? make the filenames lowercase. its the default for them to be accessed on linux.
try to check the contents of that file, maybe your script is messing up JPG uploaded files.
if that doesn't work maybe it's from your system .. an .htaccess
Look in error logs for anything that is related to this file.
精彩评论