Persits Software, Inc. Knowledge Base Articles

Default filename in file selection box

Problem Description

Browsers do not allow a file-selection box to be populated with a default value.

In many applications, it would be useful to pre-populate the <INPUT TYPE=FILE> box with a default value, so that the user could upload a file from a known location without having to browse for it. Unfortunately, web browsers do not allow this as it would be a security problem. Malicious servers could cause the client machine to upload files without the user's approval, thus "stealing" files and compromising security. For the same reasons, browsers do not allow Javascript to interact with a file input box, and file input boxes cannot be hidden.


There is no solution to this issue with AspUpload alone, as web browsers do not allow it. The only solution is to use a client-side upload control, such as Persits Software XUpload (ActiveX) or JUpload (Java), which allow a much greater range of client-side functionality including pre-selecting files to upload.