postman binary data-type detect and save in laravel request

Viewed 437

In postman there is an option to send binary datatype in a api.

I am sending that in a api where but i am unable to detect that binary file in laravel request method.

curl --location --request POST 'http://192.168.*.*/api/v1/contact_us/save' \
--header 'Authorization: Bearer some_key' \
--header 'Content-Type: image/jpeg' \
--data-binary '@/Users/username/Desktop/filename.jpeg'

Above is my curl code generated in postman.

Although i am successfully getting this file when i request in multipart/form-data

I did see a question related to it but it is not the exact case related question

1 Answers

If the HTTP request payload is purely a file (ie. not from a HTML form) then you can access it in Laravel using:

$request->getContent()
Related