How to send and receive stream files by php
This article mainly introduces php how to send and receive stream files, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
The details are as follows:
SendStreamFile.php sends the file as a stream
ReceiveStreamFile.php receives the stream file and saves it locally
SendStreamFile.php file:
ReceiveStreamFile.php file:
]
Here are some additions from other netizens
PHP reads stream files
$filepath = 'http://www.vip.com/down';$fp = fopen ($filepath, "r"); Header ("Content-type: application/octet-stream"); Header ("Accept-Ranges: bytes"); Header ("Content-Disposition: attachment; filename=xxx.pdf"); $buffer = 1024 political while (! feof ($fp)) {$file_con = fread ($fp,$buffer); echo $file_con;} fclose ($fp) Thank you for reading this article carefully. I hope the article "how to send and receive streaming files in php" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!