Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1154 How can I set the value of a fileupload form field?

irt.org | Knowledge Base | JavaScript | Form 3.3 | Q1154 [ previous next ]

Q1154 How can I set the value of a fileupload form field?

Because of security implications (scripts setting the value, and then attempting to retrieve files of your computer) the value of the fileupload form field is read only. Therefore you cannot set, or reset the value.

In Netscape Navigator 2 the value is always empty, even after the user has selected a file for upload.

In Netscape Navigator 4 it is possible to set the value after asking for extra privileges:

<form name="myForm">
<input type="file" name="myFile">
</form>

<script language="JavaScript"><!--
if (document.layers && navigator.javaEnabled()) {
    netscape.security.PrivilegeManager.enablePrivilege('UniversalFileRead');

    document.myForm.myFile.value = "/secret/passwords";
}
//--></script>

Feedback on 'Q1154 How can I set the value of a fileupload form field?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.