Is it possible to upload a file from the DOM
? Without any user intervention.
What I mean is something like this:
document.querySelector('#myFileInput').uploadFile('/path/to/file.txt')
I'm using NightmareJS
with nightmare-upload
and nightmare-iframe-manager
, but apparently nightmare-upload
doesn't work inside an iframe
: https://github.com/rosshinkley/nightmare-upload/issues/9
So I'm looking for a way to do it straight from the document
, which I have access to.
And just to be clear, when I say upload, I don't mean talking to the server, I mean doing the same as if a user clicked the "Choose File" button and selected a file.
EDIT:
This is not the same as the suggested question, because I don't really care where the file comes from, it doesn't have to be from disk, it could be (and it's actually preferred to me) that it's generated in code.
The real problema is giving the input A file, any file.