posting with formdata not working
See original GitHub issuetried doing something like
var fileData = new FormData();
fileData.append("File1", file);
return axios({
method: 'post',
url: response.data.ChunkUri,
data: fileData,
});
this returned an error from the server saying that there was no file sent. But…
vs jquery which worked and the file uploaded successfully.
var options = {
type: "POST",
url: response.data.ChunkUri,
data: fileData,
cache: false,
contentType: false,
processData: false,
success: function(e){
console.log("YAY:: " + e);
},
error: function(a){
console.log("failed:: ");
}
};
return $.ajax(options);
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
formData object not working with jquery AJAX post?
When you're sending an ajax request via jQuery and you want to send FormData you don't need to use JSON.stringify on this FormData....
Read more >formData not working , after append , i got empty form data
This is my code var formData = new FormData(); formData.append('file',file); var options = { data:{"file":formData} } console.log(formData); ...
Read more >FormData() - Web APIs - MDN Web Docs - Mozilla
The FormData() constructor creates a new FormData object.
Read more >Form data is empty while posting form through ajax using ...
We'll need to see your HTML to diagnose this, if your console.log is returning null then you've got a mistake in how you're...
Read more >Form Container - Post Form Data - Not working in AEM
Third point that you should be aware once you are using Post form data - this supports only endpoints that dose not require...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As @kalaspuffar pointed out, filename can be passed as the third parameter to
FormData#append
:@nickuraltsev’s answer in https://github.com/mzabriskie/axios/issues/318#issuecomment-218948420 really helped me out.