function qqUploadedFileXhr::save in TinyBrowser 7
Save the file to the specified path
Return value
boolean TRUE on success
File
- tinybrowser/
fileuploader.php, line 49
Class
- qqUploadedFileXhr
- Handle file uploads via XMLHttpRequest
Code
function save($path) {
$input = fopen("php://input", "r");
$temp = tmpfile();
$realSize = stream_copy_to_stream($input, $temp);
fclose($input);
if ($realSize != $this
->getSize()) {
return false;
}
$target = fopen($path, "w");
fseek($temp, 0, SEEK_SET);
stream_copy_to_stream($temp, $target);
fclose($target);
return true;
}