Mehul
Mehul

Reputation: 848

Set the file path and name properties before uploading

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.

Upvotes: 2

Views: 1469

Answers (2)

Bent André Solheim
Bent André Solheim

Reputation: 1109

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)

Upvotes: 3

Peter T. LaComb Jr.
Peter T. LaComb Jr.

Reputation: 2975

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

Upvotes: 0

Related Questions