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.

I’m getting the error:

Error: bad content-type header, unknown content-type: image/jpeg

“image/jpeg” is a valid mime-type, why am I getting this error?

CODE:

        var formidable = require("formidable");

        var form = new formidable.IncomingForm();
        form.maxFieldsSize = 2 * 1024 * 1024;

        form.parse(req, function (err, fields, files) {
            //if (err) {
            //    res.writeHead(412);
            //    res.end();
            //}
            console.log(err, fields, files);
        });

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
xargumentscommented, Feb 15, 2019

@tobq, send it as “multipart/form-data” and it will be parsed properly. Waiting for your response to see if it was fixed or not, in order to close the issue or proceed further. Thanks.

1reaction
tunnckoCorecommented, Jun 24, 2018

@analytik yea, probably the problem is the way you sending it. Hm.

How are you sending the form?

We are not doing anything except parsing and getting results.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PUT/POST Errors - Afterpay Developer Docs
A common cause of this response from PUT / POST endpoints is that the request body is missing or empty. Did this page...
Read more >
Web application configuration API - PUT error rules - Dynatrace
Web application configuration API - PUT error rules. Updates the configuration of error rules in the specified application.
Read more >
How to fix requests.put method as it is showing status error ...
I am trying to send a http request from client to server where I am updating the page. I tried testing if my...
Read more >
Getting 405 Error on Party endpoint using Postman/PUT
I'm using the iMIS demo DB. I've messed around a bunch with the web config, thinking maybe the PUT command was not being...
Read more >
Getting error when updating an issue by REST API using PUT ...
Hello! I'm using Redmine REST API and I'm getting an error (500 Internal Server Error) when I'm trying to update an issue using...
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