expire = time() + (7 * 24 * 60 * 60); file_put_contents(_DATA_DIR . "/" . $rnd_data . "/info.json", json_encode($info_json)); $putdata = fopen("php://input", "r"); $fp = fopen(_DATA_DIR . "/" . $rnd_data . "/file", "w"); while ($data = fread($putdata, 1024) and $filesize < _SIZE_LIMIT ) { $filesize += 1024 ; fwrite($fp, $data); } fclose($putdata); fclose($fp); if ($filesize < _SIZE_LIMIT ) { print(_HTTP_PROTO . '://' . _HTTP_DOMAIN . _HTTP_PATH . 'data/' . $rnd_data . '/file'); } else { delTree(_DATA_DIR . "/" . $rnd_data); print("File size exceeded (Max " . _SIZE_LIMIT . " bytes)"); } } // Informations for user if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (stristr($_SERVER["HTTP_USER_AGENT"], 'curl') or stristr($_SERVER["HTTP_USER_AGENT"], 'Wget')) { print("To upload file, use # curl --upload-file my_file " . _HTTP_PROTO . '://' . _HTTP_DOMAIN . _HTTP_PATH . "index.php\n"); } else { include("front.php" ); } } ?>