-1

index.html

 <html>
    <head>
        <title>image</title>
    </head>
    <body>
        
        <p> 
            <img src="kRIsten stewart.jpg" width="200"  height="200"  alt="Kristen stewart" title="Kristen stewart" />
            <img src="pics/Emilia clarke.jpg" height="200" width="200" alt="emilia clarke" title="emilia clarke" />
            <img src="jordan-peterson.jpg" height="200" width="200" alt="jorden-peterson" title="jorden-peterson" />
            <img src="pics/Kate winslet.jpg" height="200" width="200" alt="kate winslet" title="kate winslet" />
            <img src="/4. Codes/HTML/hosted2/Mel robbins.jpg" height="200" width="200" alt="Mel robbins" title="Mel robbins"/>
            <img src="raining gif.gif" height="200" width="200" alt="raining gif" title="raining gif" />

            
        </p>

    </body>
</html>

Location : F:/4. codes/html/hosted2/

This hosted2 folder is hosted on surge.sh . It contains index.html file, jorden-peterson.jpg, kristen stewart.jpg, Mel robbins.jpg, raining.gif. It also contains a folder named pics, which contains Emilia clarke.jpg, and kate winslet.jpg.

When I open this index.html using file scheme file:/// F:/..., all 6 pics display in the web-browser.

But when I open this file through URL http://unsuitable-rate_bonapart.surge.sh/ where it is hosted, I am unable to see kristen stewart.jpg and Mel robbins.jpg. Why is that ?

1.kristen stewart.jpg.

I make 2 letters uppercase while giving path in index.html file KRIsten stewart.jpg. But in location the file is kristen stewart.jpg

5.Mel robbins.jpg

/4. Codes/HTML/hosted2/Mel robbins.jpg I gave absolute path.

So what I feel that on browser while uploading I uploaded hosted2 folder so it doesn't know upper folders to that(hosted2) so It can't show Mel robbins.jpg and kristen stewart.jpg. I feel it's due to surge.sh might have policy that the file name should be case sensitive.

So I feel this. I don't know exactly. Please explain why this is happening.

programmerq
  • 6,262
  • 25
  • 40
Abhishek Mane
  • 619
  • 7
  • 20
  • The webserver and/or the OS the webserver is running on decide if the filenames are case sensitive or not. On linux systems, the name is case sensitive, on windows system (like your PC) the name is case-insensive. So on **your** PC it works fine, but on a deployed server with case-sensitive names, the filename "kRIsten stewart.jpg" is different than "kristen stewart.jpg". In fact, http://unsuitable-rate_bonapart.surge.sh/kristen%20stewart.jpg works just fine. – Progman Jul 22 '21 at 19:54

1 Answers1

0

First of all don't use spaces in your img src (replace them by "-" or "_").

If your kristen stewart's file name is kristen-stewart.jpg then call it by kristen-stewart.jpg not kRIsten-stewart.jpg.

Then /4. Codes/HTML/hosted2/Mel robbins.jpg is not an absolute path. An absolute path will be (for example) https://yourdomainname.com/yourimage.jpg. So maybe consider relative path or a valide absolute path.

Note: Add "./" at the beginning of your src to use the same folder and "../" to move to the upper folder.