Skip to content

Instantly share code, notes, and snippets.

@mis4s
Created July 16, 2018 21:10
Show Gist options
  • Save mis4s/842b7d215b109e6207da631fcfb20f0e to your computer and use it in GitHub Desktop.
Save mis4s/842b7d215b109e6207da631fcfb20f0e to your computer and use it in GitHub Desktop.
<?php
$inputHandler = fopen('php://input', "r");
$path = realpath(dirname(__FILE__) . '/upload');
$fileHandler = fopen($path . '/' . 'some-name-file', "a+");
while (true) {
$buffer = fgets($inputHandler, 4096);
if (strlen($buffer) == 0) {
fclose($inputHandler);
fclose($fileHandler);
break;
}
fwrite($fileHandler, $buffer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment