In PHP, output as an array of bytes and a stream. Which one is better?

I need to write a php web service to output a file to a Windows client application. I have two bytes of Array and Streaming. Which one is better and easier to implement in PHP?

Thank you for your help.

0
source share
1 answer

How about just ....

$file = 'some_file.exe'; $_size = filesize($_file); header('Content-Type: binary/octet-stream'); header('Content-Length: '.$_size); header('Content-Disposition: attachment; filename="' . basename($file) . '"; size=" . $_size); @readfile($file); 

Note: see comment for some problems with binary files .

0
source

Source: https://habr.com/ru/post/1236368/


All Articles