Simulate XHR2 file upload
问题 I have a HTML upload button to send (multiple) files to a server which responds with JSON. Based on that response, my application flow continues. Now, to test the rest of my code (dependent on the server response), I would like to simulate the file upload so that I do not have to manually select and upload new files on every reload. Following is a simplified version of my upload method: uploadToServer: function (file) { var self = this, data = new FormData(), xhr = new XMLHttpRequest(); //