Last active
December 12, 2015 05:18
-
-
Save freshteapot/4720707 to your computer and use it in GitHub Desktop.
Sample of streaming data to a server. - Make sure php://input has not been used first.
- Start with this then work it into your code so you know it works.
- The client end, should returns small amounts for memory_get_usage even when you have a very large file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo memory_get_usage() . "\n"; | |
$fileName = "/tmp/postedData"; | |
$f = fopen($fileName, "w"); | |
$s = fopen("php://input", "r"); | |
while($kb = fread($s, 1024)) { | |
fwrite($f, $kb, 1024); | |
} | |
fclose($f); | |
fclose($s); | |
echo memory_get_usage() . "\n"; | |
echo "\n\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment