views:

612

answers:

3

If you know the local path and file name of the file you want the end user to upload (via browser). Then is it possible to pre-set these properties for the HTML file input element (or any upload control)? So when the user clicks 'browse' to select the file to upload, then the dialog has preselected the filename.

Btw, assume that this is for an intranet where the necessary directory/file do exist locally.

A: 

This type of interaction with file-upload controls is disabled for security reasons.

Peter LaComb Jr.
You might be able to do this with a flash-based upload control though.
Peter LaComb Jr.
Yes, that was my guess as well. But since it's just a suggestion of what file to upload, I thought it might be possible.
Mehul
+3  A: 

Unless it is a custom upload control, this cannot be done for security reasons.

If a html page could set the file to be uploaded using javascript, for instance, an arbitrary html page could upload any file from the client computer (form submission can be triggered via javascript)

Bent André Solheim
Your explanation of the security risk is simple and accurate.
Peter LaComb Jr.