I am trying to achieve an iframe transport file upload, using the blueimp file upload plugin as follows:
$(jQueryUploadInput).fileupload();
$(jQueryUploadInput).fileupload('send', {
forceIframeTransport: true,
fileUpload: profilePicInput,
url: $.acme.resource.links.editProfilePictureUrl
})
.error(function(jqXHR, textStatus, errorThrown) {
debugger;
})
.success(function(result, textStatus, jqXHR) {
debugger;
});
When I debug the view that needs the file upload, the debugger
call inside my error
function is hit, but all three parameters are undefined, as if the error function was invoked for no reason. profilePicInput
is a valid file input with one selected file. The action pointed to by $.acme.resource.links.editProfilePictureUrl
is a valid action url, but a breakpoint in my controller never even gets hit. I also have no idea how to proceed.
I know the API doc says:
The fileInput property must be a jQuery collection with an input of type file with a valid files selection.
so I have tried both ways of setting the fileUpload
option, with the same result.
fileUpload: profilePicInput
fileUpload: $(profilePicInput)
Just BTW, this code is being called inside a view model script, not directly in the view itself, if that might mean or affect anyhting. I don't see how, because the viewmodel script is loaded into the view anyway.