Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

119
Views
Remove "filename" header from FormData

I'm trying to post a request using FormData(), I need to include the "content type" header so I'm using the blob to append entries to my form, but this automatically sets the filename to "blob"

const formData = new FormData();

        const obj1 = new Blob([json_data], {type: 'text/plain; encoding=utf-8'});
        formData.append("small_config", obj1);

        const obj2 = new Blob([client], {type: 'text/plain; encoding=utf-8'});
        formData.append("app_type", obj2);

        const obj3 = new Blob([version], {type: 'text/plain; encoding=utf-8'});
        formData.append("product_version", obj3);

        let thumb = await fetch(my_url, {
            method: 'POST',
            mode: 'cors',
            cache: 'no-cache',
            credentials: 'same-origin',
            redirect: 'follow',
            referrerPolicy: 'no-referrer',
            body: formData
        });

Is there a way to both set the content type and not include filename?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There is no way to have FormData not send a filename with an appended blob. You can send an empty string however.

Use the 3rd parameter to FormData.append

formData.append("small_config", obj1, 'My Filename');

So for your case, try an empty string.

formData.append("small_config", obj1, '');

From Mozilla docs:

filename Optional
The filename reported to the server (a USVString), when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!