question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Content-Type': 'multipart/form-data' Can not work normally

See original GitHub issue

I use {‘Content-Type’: ‘multipart / form-data’} to upload files but not work I use the following code:

let formBox = new FormData();
formBox.append('file', files[0]);
axios({
	method: 'post',
	url: api.pushZipFile,
	data: formBox,
	headers: {'Content-Type': 'multipart/form-data'}
})

Return the following results: image image

I refer to Issues to find a solution, but it did not succeed. https://github.com/mzabriskie/axios/issues/318

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15

github_iconTop GitHub Comments

10reactions
tmaly1980commented, Aug 30, 2017

I get the same ‘[object Object]’ string in the payload. Anyone figure this out?

4reactions
yss14commented, May 6, 2017

Got into the same problem. Applying your workaround, do you also see as request payload in chrome [object Object]?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Content type 'multipart/form-data;boundary - Stack Overflow
I just noticed, you have set contentType=false while making ajax request. Are you certain that it is correct. Maybe you need to pass...
Read more >
[Multipart/form-data] Getting a wrong media file typer error on ...
I keep getting a response error stating the media file type is incorrect. BTW: the text to binary does not seem to work...
Read more >
POST - HTTP - MDN Web Docs
The HTTP POST method sends data to the server. The type of the body of the request is indicated by the Content-Type header....
Read more >
Multipart/form-data content type - Software AG Documentation
Represents a binary part of a multipart/form-data payload where the content of the part is binary or the content of the file itself....
Read more >
RFC1341(MIME) : 7 The Multipart content type
A body part is NOT to be interpreted as actually being an RFC 822 message. ... All other header fields are generally to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found