Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

347
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda