Programmatically set the value of a type=”file” input HTML element? [duplicate]

Unfortunately this is not possible as it would be a security issue. Javascript control over file input fields is very limited. Otherwise people could use this to steal files from user’s computers.

Since you have control over the browser, you can send the file using a normal HTTPWebRequest, but it can’t be done in JavaScript.

Leave a Comment