Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Reference to Files

Reference to Files

Scheduled Pinned Locked Moved Web Development
sysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Grahamfff
    wrote on last edited by
    #1

    I have been writing my first CGI program, but have problems loading images and background files. Both the Server and Browser are on the same PC. I needed to write:- cout << "" to get the images loaded. i.e. the following line did not work:- cout << "" I tried this and it did not work cout << ""; Later in the program when I tried this the image was not displayed (little box with red cross - image not found) Also tried a different image as follows, did not load. cout << "![](\"./images/smiley.gif\")"; grahamfff

    A 1 Reply Last reply
    0
    • G Grahamfff

      I have been writing my first CGI program, but have problems loading images and background files. Both the Server and Browser are on the same PC. I needed to write:- cout << "" to get the images loaded. i.e. the following line did not work:- cout << "" I tried this and it did not work cout << ""; Later in the program when I tried this the image was not displayed (little box with red cross - image not found) Also tried a different image as follows, did not load. cout << "![](\"./images/smiley.gif\")"; grahamfff

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      You have to reference the images (and any other resources) in terms of the web path. Forget the fact that you are on a filesystem. As far as the web server is concerned you are on a virtual filesystem. So: img src='http://localhost/maybe-sub-dir/image-name.jpg' if you get my meaning :)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups