jquery - Trigger file upload via Javascript only -


I want to write a browser add-on that automatically uploads the file to the page. So it will be done in pure javascript.

It is that I have / know:

  1. input # some id

  2. The file name and location in the computer

I am trying to "hardcode" in "codecode"

Code> inputElement.click () As inputElement The input querySelector .

  • Use initMouseEvent but I got the error Uncustom Type error: Properties 'dispatchEvent' can not be read

    < / Li>

    So my questions are:

    1. How to trigger the click input of the file upload element?

    2. Improved: How to Process Upload Completely? Pass the file name + location to basically upload (like the user clicks the OK to open the file from the dialog)

    UPDATE 1: / Strong>

    I was reading this probably a file uploaded from the file system is not possible. How about these options:

    1. We can get a file from the URL (HTTC)

    2. The file is just image and Javascript is in Memory (Base64)

    Any of the above should be fixed, if it can be automatically uploaded and bypasses the dialog box and the file is localized The file can search through the system. I'm wondering if the image DOM or Canvas can be pulled?

  • People commented, can not do this. For security reasons, you have no access to filling up a file input until programmatic Think about it, some friends can add a simple script to steal files from your computer and you will not even know!

    As far as I know, can not be done.


    Comments

    Popular posts from this blog

    winforms - C# Form - Property Change -

    java - Messages from .properties file do not display UTF-8 characters -

    javascript - amcharts makechart not working -