简体   繁体   中英

Browser does not show .JPG files (with capital letters)

In my site, I give an option to upload images with.jpg and.JPG extension. They both work and I can see both on 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:

  1. Is the URL valid? Foo.jpg is not the same as foo.jpg .
  2. Does the browser receive the file? Firebug should tell you.
  3. What's the HTTP response code? Firebug should tell you.
  4. 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.

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.

Your using linux/apache right? make the filenames lowercase. its the default for them to be accessed on linux.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM