Many browsers will refuse to download local files using XMLHttpRequest as a security measure. AJAX requests are limited to the same origin policy , but, as a link to the Wikipedia page,
The behavior of checks with the same origin and related mechanisms is not well defined in a number of cases, for example, for protocols that do not have a clearly defined host or port name associated with their URLs (file :, data: etc. d.).
Downloading a local file, even with a relative URL, is the same as downloading a file using the file: protocol. Many web browsers limit this, not in vain - imagine that a malicious HTML file is running on your local computer that can download any file to your computer and send its contents to a remote server.
Therefore, I assume that the problem is that you are trying to upload a local file. Try serving your script on a local or remote web server and see if this fixes the problem. (If you have Python installed, you can go to the appropriate directory and run python -m SimpleHTTPServer 8000 , and then go to http: // localhost: 8000 / in your browser).
source share