I saw here: Fill input file form with JavaScript that it is not possible to change the value manually of an input file. And I understand the security reason, we don't want the webpage to be able to upload any file of the user.
But in the meantime, I see here https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects that you can send files if you have it in JavaScript as long as the file is a File
object.
And I have the File
object in JavaScript. So, is there a way to avoid the use of XMLHttpRequest
and use the normal form to send the File
? I want to avoid JavaScript to send the file (which is in the JavaScript memory and not on the user disk).