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

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
phpmon
New php-forum User
New php-forum User
Posts: 6
Joined: Mon Apr 21, 2003 9:49 am

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

sigix
php-forum Active User
php-forum Active User
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

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 ... :!:
something strange will be ...

phpmon
New php-forum User
New php-forum User
Posts: 6
Joined: Mon Apr 21, 2003 9:49 am

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.

User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

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.
Image

Post Reply
  • Information
  • Who is online

    Users browsing this forum: ecstaticcoder and 4 guests