i was trying to upload a file via $.ajax call using jQuery.. and formData
in order to append the file to the formData i did the following:
var fd = new formData();
fd.append($('#myFileInput));
that failed
then i tried :
var fd = new formData();
fd.append($('#myFileInput).files[0]);
and again it failed then i tried:
var fd = new formData();
fd.append($('#myFileInput')[0].files[0]);
and that really worked and i could send my file to the server..
my question is:
why should I use the [0] next to the jquery object representing my file input element.. ?? notice that i didn't use the "multiple" attribute for the file input