Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

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

General discussions related to php

Moderators: macek, egami, gesf

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

Postby phpmon » Fri Oct 10, 2003 8:45 am

$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/ ... 000006.png
phpmon
New php-forum User
New php-forum User
 
Posts: 6
Joined: Mon Apr 21, 2003 9:49 am

Postby sigix » Fri Oct 10, 2003 9:54 am

:roll: sorry what ?
you mean to give absolute path for image
/var/log/........... is the absolute path to the image ... :!:
sigix
php-forum Active User
php-forum Active User
 
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Postby phpmon » Fri Oct 10, 2003 10:51 am

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.
phpmon
New php-forum User
New php-forum User
 
Posts: 6
Joined: Mon Apr 21, 2003 9:49 am

Postby swirlee » Fri Oct 10, 2003 11:07 am

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.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back


Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.