Reputation: 16900
Can anybody tell me how do i give absolute path of the img tag's src attribute?
The following doesn't work
<img alt="NO IMAGE" src="/home/administrator/tiger-info0[1].gif"/>
I am working On Ubuntu and i am very sure that image exists on this path.
Upvotes: 0
Views: 467
Reputation: 198
You cannot access files that are not in your document root. Get Java application server to not delete your folder. You can probably do this by having one folder into which your users can upload files, and add that folder to your project. You can let users create subfolders inside that main folder, and since the main folder is a part of your project, cleaning the build will not automatically delete it or its subfolders.
Upvotes: 0
Reputation: 344301
This is probably happening because the image is located outside the web server's document root.
Your web server will not be able to serve anything from outside the document root. One possible workaround is to use a scripting language that has access to the file system, and route the images through the script. For example, you may want to check out the following implementation in php:
You can also create a symbolic link of /home/administrator/
into the document root:
ln -s /www/yoursite /home/administrator
Upvotes: 2
Reputation: 3271
Give your path correctly with domain or use ../ or ./ is for to represent correct relative path.
Upvotes: 0
Reputation: 30170
if you are making a local html page you can use that path but if you are creating a website you have to use the absolute path to the document root. And make sure the image path is correct (use firebug)
Upvotes: 0
Reputation: 8778
hmm why don't you copy the image to your web directory and give it the relative path? you server (apache?) may not be able to access the file to serve the browser.
Upvotes: 0