Re: Showing abosolute path in $_FILES

From: Date: Sat, 06 Dec 2003 13:09:34 +0000
Subject: Re: Showing abosolute path in $_FILES
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4282@lists.php.net to get a copy of this message
This question does not belong here but to php-general. And I'm quite sure someone at php-general would point out it does not belong there either because php is server side and what you are trying to achieve must be done client side :-) To answer your question, browsers do not send the full path of file inputs. But you can assign the value of the file input to a hidden input in onsubmit event handler: function savePath(f) { f.elements['fullpath'].value = f.elements['file'].value; } <form ...... onsubmit="savePath(this);"> <input type="hidden" name="fullpath" value=""><br> <input type="file" name="file"><br> ..... </form> David Green wrote:
Quick file question. I want to have a user locate a file, and have the absolute path be saved as a variable. I have a form of type "file". In the form tag, I have enctype="multipart/form-data". On the target page, I call it by using $file = $_FILES['file']['name']. When i navigate to the file using the form, I can see the whole path in the "file" box, but when I print $file, it shows me only the file name without the path. I do not want to upload the file, I only want to save the path as a variable. How can I do this? Thanks! -David


« previous php.gtk.general (#4282) next »