Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

laracoft's avatar

Saving a binary file from cURL `--data-binary`

Any idea how I can save this file in a Laravel controller? The standard response() doesn't recognize a file. Thank you.

curl "https://my.laravel.com/upload?filename=user_crash.log" -X POST --data-binary @user_crash.log -H "Content-Type: application/binary"
0 likes
1 reply
laracoft's avatar
laracoft
OP
Best Answer
Level 27
$binary = file_get_contents('php://input');

Please or to participate in this conversation.