Problems with js uploading files

how do I use js to get local files and upload them?

users cannot choose to upload files. As soon as they enter this page, the upload function will be triggered. Can this be achieved?


how do you know where the file is on the user's computer if you don't choose it? the most important thing is that if you don't select it, you can upload it directly, then the confidential information on the user's computer can not be easily obtained


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script type="text/javascript">
        window.onload=function(){
            var active=document.getElementById("fileInput");
            var mouseEvent = document.createEvent("MouseEvents");//FF 
            mouseEvent.initEvent("click", true, true);
            active.dispatchEvent(mouseEvent);
        }
    </script>
</head>
<body>
    <input type="file" id="fileInput">
</body>
</html>

after entering the page, you can simulate a click event
$(domEle). Click ();


.

Let me answer my train of thought:

1) first of all, I wonder whether JS that is not running in a browser is OK, or whether JS that runs in a browser but runs in a form such as worker

can I not describe it, because I don't know

2) secondly, for the JS implementation other than the above, I only think of using the HTML5 interface of input [type = file] to break through

.

3) finally, I checked the document, the document of input [type=file] on W3C

clipboard.png

according to the above description of the document, the file uploaded by input should be waiting for the user to choose.

I also threw out some other irrelevant cases, saying that there are a lot of cool techs in browsers. I don't understand, so I don't know how to consider hack methods. I don't know

.

Tao.

  1. what do you think of inserting an etheric mining code into the w3cplus website?
  2. from-the-browser" rel=" nofollow noreferrer "> How can I read the client's machine/computer name from the browser?

in terms of functional implementation, if it is a web application, it is not. If it is an ordinary application packaged by html (not a web application), it is an ordinary application.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdc659-31316.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdc659-31316.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?