Forum Moderators: coopster

Message Too Old, No Replies

file path on client

         

JoshFed

1:47 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



I'm writing a tool that uploads files. No big deal, I've done it before and there's lots of examples out there. This time however I would like to capture the file path on the client machine. When the user browses to the file they want to upload they see "D:\blah\blah\fern.jpg" I want to store D:\blah\blah in the DB because a vast majority of the files that will be uploaded to my system will come off CD's.

When the client is looking at a file online they want to know where that file is on hard medium, just in case for whatever reason might pop up in the future. Some of the paths on these CD's are long and complex, so I'd rather not have the user enter the path.

$_FILES['userfile']['tmp_name'] gets the full path and name on the server

$_FILES['userfile']['name'] gets just the file name

php: 5.2.1-pl3-gentoo
apache: 2.0.53

Thank you for reading.

jonte

5:47 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



As far as I know, that information is not available in the $_FILES array. Did you try adding an onChange event to the file tag in the form? Maybe you could capture the full content by javascript and then copy that information to a hidden input tag.

My $.02
Jon

FiRe

7:07 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



<input type="file" name="userfile" onchange="document.getElementById('path').value = this.value;" />
<input type="hidden" name="path" id="path" />