You can set the value of a file input if you have elevated security settings (as is the case on an intranet).
If this isn't an intranet site, you'll have to get the user to trust your site to do that. In IE, that means granting your site elevated privileges.
I'm not sure how it's done in IE from the standpoint of code, it may just be a matter of trusting the site. In Firefox, you have to have a signed script. Without a signed script, you can enable a special security dialogue, which once allowed will allow you to set the value of file objects.
To do that without a signed script, following is the process:
Add the following to prefs.
js (located in Firefox profile folder)
Code:
user_pref("signed.applets.codebase_principal_support", true);
Then your script must ask the user for permission, I think both of these are required.
Code:
try
{
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
}
catch($err)
{
var $privileges = false;
alert('Error: Unable to perform file upload. App was denied elevated privileges to do so.');
}
AND
Code:
try
{
netscape.security.PrivilegeManager.enablePrivilege('UniversalFileRead');
}
catch($err)
{
var $privileges = false;
alert('Error: Unable to perform file upload. App was denied elevated privileges to do so.');
}
This technique enables the security prompt on your computer alone, which is good for testing. To get the prompt on everyone else's, you must have a signed script, or you must manually install that line in their prefs.
js file.
So, as you can see there are a lot of security hurdles, and rightly so. If you could just arbitrarily set the value of the file upload, you could upload files from the user's computer without their knowing, and that would be bad.
HTH!
Regards,
Rich
--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results
http://www.catb.org/~esr/faqs/smart-questions.html