17
rated 0 times
[
24]
[
7]
/ answers: 1 / hits: 20168
/ 8 Years ago, fri, february 5, 2016, 12:00:00
I'm using a 3rd party library which wants to load in a file via the HTML file system, as in:
<input id=fileupload type=file onchange=LoadAndDisplayFile(this.files[0])>
This works great, except I'd like to pass in a url to a file stored on the serverr rather than have the user upload a file.
I tried using:
var myFile = new File (path/to/file);
with the hope that I'd then be able to pass myFile
into LoadAndDisplayFile()
but I get the following error:
Uncaught TypeError: Failed to construct 'File': 2 arguments required, but only 1 present.
I'm sure this is a noob question, but what am I missing here?
More From » javascript