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

338
Views
Upload a Blob as a regular file

I have a server running Laravel, hosting an endpoint expecting a file parameter, upon which it validates the rules required and image.

In Javascript, I use Axios to send a HTTP request containing a blob of type image/png. Code example:

const data = new FormData();
data.append('file', blob);
axios.post(submitUrl, data).then(r => console.log(r));

I can't seem to get that request to pass Laravel's validation, reporting that the file-upload has failed and responding with 422 Unprocessable Entity.

How do I get Axios to send a blob, just as a regular form would upload an image?

Things (all of them at once, and invidually) I tried so far:

  • Wrapping the blob in a File object, specifying it's lastModified parameter and filename;
  • Adjusting the Content-Type header to reflect the Blob MIME type;
  • Sending it as base64 instead of blob;
  • Just using fetch() and making the request body contain the image.

So far all my attempts are unsuccessful. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
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!