0

I have an image whose url is ../path/to/image, but the ../ doesn't work. The url for my webpage is http://localhost:8080/account.html. I can't seem to find a solution online.

I believe the directory is relative to the webpage url. I've tried starting from file:///C:/ and it works, but I don't want to use that because my other clients will use the domain name, which in this case is localhost.

Is there a way to solve this without moving folders?

Kino Bacaltos
  • 373
  • 1
  • 2
  • 16
  • You cannot link to a file that is not publicly accessible. Your server is not serving that file to the user so it cannot be accessed directly. – frobinsonj Aug 02 '18 at 13:22
  • @Profit so I should just move it? – Kino Bacaltos Aug 02 '18 at 13:23
  • You can either move it somewhere within your web directory or allow the user to access it through a serverside script. Here's a solution using PHP: https://stackoverflow.com/questions/258365/php-link-to-image-file-outside-default-web-directory – frobinsonj Aug 02 '18 at 13:25

1 Answers1

0

Try this /path/to/image.jpg

Remove the dots and just add this -> / at the start of the path , that means that the path is going to root directory