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:
File object, specifying it's lastModified parameter and filename;Content-Type header to reflect the Blob MIME type;base64 instead of blob;fetch() and making the request body contain the image.So far all my attempts are unsuccessful. Thanks in advance.