Skip to content Skip to sidebar Skip to footer

Submitting Data Instead Of A File For An Input Form

I'm using jQuery to retrieve an image and post it to another form: handler = function(data, status) { ... var fd; fd = new FormData; fd.append('file', data); jQ

Solution 1:

You're sending a string which will not be recognized as a file. Try sending a blob

fd.append("file", new Blob([data], { "type" : "text/plain" }));

I'm pretty sure this will only work for text files, unless you set the responseType on the original request.

Post a Comment for "Submitting Data Instead Of A File For An Input Form"