Uploading images via browser form or JSON request
Hi Guys, In an app which I have been working on for some time and which I am now getting close to completion, I can create a record either via a form or via json as per normal in Laravel.
One thing though, while Laravel takes both requests perfectly it does not seem to do so when images are brought into the equation.
I have a validation rule in my FormRequest as follows:
'record_image' => 'image|max:500'
This works fine and enforces a maximum image file upload of 500KB when used in the browser form.
However if I pass the image base64 encoded in a JSON request, it fails, presumably because it is now a string rather than image.
I have checked the documentation but cannot seem to see a specific reference to Laravel handling the file uploads in both browser and JSON.
Is there some elegant/Eloquent(pun intended) way that Laravel handles this which I am missing.
Thanks, Barry.
Please or to participate in this conversation.