Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  6] [ 2]  / answers: 1 / hits: 10721  / 10 Years ago, fri, september 5, 2014, 12:00:00

I have an <input type=file> with a local file selected, which I would like to upload to the server as a File, not as a Blob. I'm grabbing it with jQuery (element and then .files[0] or .prop('files')[0]).



By every indication but one, the prototype of this object is File:



Object.getPrototypeOf(file) // => File {slice: function}
file.__proto__ // => File {slice: function}
file.constructor // => function File() { [native code] }
file.constructor.prototype // => File {slice: function}


And yet:



file instanceof File        // => false
file instanceof Blob // => true


What gives?


More From » file

 Answers
10

The answer turned out to by inf3rno's comment – my webapp was overwrting the File variable.


[#42695] Wednesday, September 3, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pranavrorys

Total Points: 466
Total Questions: 87
Total Answers: 115

Location: Barbados
Member since Sun, Nov 27, 2022
2 Years ago
pranavrorys questions
Fri, May 27, 22, 00:00, 2 Years ago
Thu, Oct 28, 21, 00:00, 3 Years ago
Sat, May 30, 20, 00:00, 4 Years ago
Fri, Dec 20, 19, 00:00, 5 Years ago
;