Re: Appending url to file name...

From: Date: Mon, 08 Apr 2002 15:27:20 +0000
Subject: Re: Appending url to file name...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92063@lists.php.net to get a copy of this message
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 ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com

« previous php.general (#92063) next »