www.webdeveloper.com
Results 1 to 4 of 4

Thread: How do I put html file and image in same directory

  1. #1
    Join Date
    Apr 2012
    Posts
    110

    How do I put html file and image in same directory

    Hi, Im doing html code to upload the image, but only a block comes up, I heard I must have the html file and image in a same directory, but how do I do that, the images are in a file called webpage templates, then the subfolder is model3.jpg. I just named the image model3,jpg.

    I put this code in. <img style = "width: 70px: height: 70px: border: 0;" src = "model3.jpg" alt = "text description">

    Only an empty block comes up., no image.

  2. #2
    Join Date
    Mar 2012
    Posts
    1,426
    Quote Originally Posted by wildguy2 View Post
    Hi, Im doing html code to upload the image, but only a block comes up, I heard I must have the html file and image in a same directory, but how do I do that, the images are in a file called webpage templates, then the subfolder is model3.jpg. I just named the image model3,jpg.

    I put this code in. <img style = "width: 70px: height: 70px: border: 0;" src = "model3.jpg" alt = "text description">

    Only an empty block comes up., no image.
    The blank box is coming up probably because the image file is either:

    1. Not in the same directory as the html file. If so, what you need to do is include a relative path of the image file. e.g. If the html file is in a given folder and the image is in a sub-folder of that folder called "graphics" the syntax should be as above except:

    src = "graphics/model3.jpg"

    2. In the folder, but the name is incorrect. File names on many servers are case sensitive. E.g. If the image file is called "Model3.jpg", or even "model3.JPG", the server will not find it because you have told it to load "model3.jpg".

  3. #3
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,208
    See Absolute and Relative Paths. Do not name folders and files using whitespace (like "webpage templates") and use lowercase. Files do not have to be in the same folder to work, but you should have a directory structure that makes sense and use the right path to files that maintain the correct relationship.

  4. #4
    Join Date
    Jan 2012
    Posts
    51
    You forgot to add the file name, to locate the image.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles