PDA

View Full Version : HTML - Browse button (file upload object)




mcborder
Jun 4, 2004, 06:04 AM
The application I support uses the browse input type object so that the user can upload files. On a PC, when using this option the full file path is brought back, however, on a MAC (using IE), only the file name is brought back. I really need the full path. I've done some searches about this, but cannot find anything to help, just that this is the way the MAC works. There has to be some kind of work around. Any help is greatly appreciated.

Thanks!



jeremy.king
Jun 4, 2004, 10:22 AM
Curious why you would need the full path? All the web application should worry about is that a file was uploaded. Your need to know the clients full path to the file is troublesome, perhaps you could explain.

Have you tried
document.formname.elementname.value where formname is the name of your form and elementname is the name of the fileUpload form field.

mcborder
Jun 7, 2004, 12:45 PM
The file can come from one of many servers and/or any directory which are mounted on the server where the files are being copied to. That's the need for the full path.
Your suggestion is currently what the code is.

jeremy.king
Jun 7, 2004, 05:02 PM
The file can come from one of many servers and/or any directory which are mounted on the server where the files are being copied to. That's the need for the full path.
Your suggestion is currently what the code is.

This doesn't really make any sense to me. Your response indicates that you are trying to move files from one machine to another, and BOTH are on the same network. If this is true , then you shouldn't really be uploading files through a web browser. Instead, your application should allow the user to type or select a file on one machine, and then type/select the destination on the other.

If you really want to use the file upload facility, your webserver will put these somewhere in the filepath of the webserver (configured by a sysadmin). You can then read this file from the temp location and do what you like.

The point is that IT DOESN'T MATTER where the file resides on the users machine, as it's going to be uploaded as part of the form object and then your webserver will then store that file somewhere in the filesystem depending on your configuration.

Westside guy
Jun 7, 2004, 11:25 PM
If you're using Perl's CGI module, you should be able to get the full path just by grabbing the value of the textbox where the name was entered. Basically the equivalent of the PHP code already posted.

So I guess the question is, how exactly are you grabbing the filename? CGI, PHP, or something else?