[PHP] Getting uploaded filename directory
In setting up a form to allow a user to upload a file, upon submission of that form, you can get the actual file name that is being uploaded by accessing the variable: $userfile_name (assuming the form element's name where the user specifies the file is $userfile). Is there a way to get the full path as well? ie: c:\program files\this directory\uploaded_file.txt ? I tried echoing out $userfile to no avail. I also tried some javascript that when the form was submitted, the value for the userfile element was copied to a hidden form element, but that didn't work either. Any ideas? Suggestions? Chris
Re: [PHP] Getting uploaded filename directory
If the path doesn't ride along in the _name variable (and I don't know of a case when it would), Nope. The value of the input element when the type = file isn't useable, except as an initial file name, so using JavaScript won't be helpful. I think the input element is implemented for type = file that way on purpose. Providing user/visitor filesystem information is a privacy/security risk. Your last chance to get the path info would be to ask the user to explicitly put it into a text form field ;) ~Chris /\ \ / September 11, 2001 X We Are All New Yorkers / \ rm -rf /bin/laden On Mon, 12 Nov 2001, Boget, Chris wrote: In setting up a form to allow a user to upload a file, upon submission of that form, you can get the actual file name that is being uploaded by accessing the variable: $userfile_name (assuming the form element's name where the user specifies the file is $userfile). Is there a way to get the full path as well? ie: c:\program files\this directory\uploaded_file.txt ? I tried echoing out $userfile to no avail. I also tried some javascript that when the form was submitted, the value for the userfile element was copied to a hidden form element, but that didn't work either. Any ideas? Suggestions? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Getting uploaded filename directory
In setting up a form to allow a user to upload a file, upon submission of that form, you can get the actual file name that is being uploaded by accessing the variable: $userfile_name (assuming the form element's name where the user specifies the file is $userfile). Is there a way to get the full path as well? ie: c:\program files\this directory\uploaded_file.txt ? I tried echoing out $userfile to no avail. I also tried some javascript that when the form was submitted, the value for the userfile element was copied to a hidden form element, but that didn't work either. Any ideas? Suggestions? It's not very secure, I think it isn't possible to get a full path Lubo Gabal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]