On Monday, April 8, 2002, at 11:09  AM, Jas wrote:

> Ok this is an unusual problem, at least to a newbie like myself... I am
> trying to develop a user form to select an image from a directory by 
> use of
> a select box that once the item is selected it will put that selection 
> into
> a db field and this part I have working fine, however now I will need 
> to be
> able to do something which I am not entirely clear on where to start...
> 1- I need to have the selection append the file path to the selected 
> file...
> i.e. http://localhost/images/file_name.jpg, so far it only puts
> file_name.jpg into the database table.

If you already know that the file will always be in the same directory, 
you could just prepend the string "http://localhost/images/"; to the 
query result in your query --

SELECT CONCAT('http://localhost/images/', tablename.image_name) AS 
image_name FROM tablename

Or, if each file may have a different path, check out the dirname() 
function -- http://www.php.net/manual/en/function.dirname.php

I think that you will have to add "http://virtualhost"; in any case, as 
this is a component of a URI and not a part of the file's path (and will 
not be automatically generated by dirname() or any other function that I 
know of).



Erik Price
Web Developer Temp
Media Lab, H.H. Brown

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to