Skip to content Skip to sidebar Skip to footer

Add A File (JS Object) To Input Type="file"

I need a way to add a File object to a file input field. Note that I do not want to set the value of the file field. (which is a security risk, ... I know that) I already have the

Solution 1:

No, you can't.

Taken from here:

It seems like you want to take the File object from the drop event and assign it to the element. Unfortunately, you can't do that. Only the user can select files; you can't dynamically change the files which will be uploaded because browsers deny JavaScript this ability for security reasons.


Post a Comment for "Add A File (JS Object) To Input Type="file""