does any body now how to do absolute call to img tag in php?

A

Anonymous

Guest
$db="demo";
$_POST['relative_dir']="Information PNG/20031009_173037/PNG/"
$current_file="00000006.png"

my image is located in:
/var/local/phpmon/demo/incoming/Information PNG/20031009_173037/PNG/00000006.png

echo "<img src='../../local/phpmon/".$db."/incoming/".$_POST['relative_dir'].$current_file."'>";

php converts it to:
http://dev1/local/phpmon/demo/incoming/Information%20PNG/20031009_173037/PNG/00000006.png
 
:roll: sorry what ?
you mean to give absolute path for image
/var/log/........... is the absolute path to the image ... :!:
 
i think the problem is http://dev1=/var/www/html according to php.

and my images are /var/local/..... that is why i was trying to ../../ back up but that is not working.
 
The user's browser can only retrieve files that are under the web site's document root. /, as far as the user's browser is concerned, is the root of your web site, NOT the root of your filesystem, and so they can't retrieve anything higher in the hierarchy (with very good reason!).

If you want to user to be able to access an image, you can use PHP to move it under the document root.
 
Back
Top