- fixed all DEFINE to define in config* files - Updates Login class with missing strict declarations - some fixes in Login class for possible errors - Basic class return array layout updates for all rgb sets plus correct static update - Basic class timestamp method fix for not full set (eg missing seconds) - Basic class add method for getting linecount from a file - DB IO class gets a get settings return value method
47 lines
835 B
PHP
Executable File
47 lines
835 B
PHP
Executable File
<?php
|
|
|
|
namespace FileUpload\Core;
|
|
|
|
/**
|
|
* Handle file uploads via XMLHttpRequest
|
|
*/
|
|
class qqUploadedFileXhr
|
|
{
|
|
/**
|
|
* Save the file to the specified path
|
|
* @return boolean TRUE on success
|
|
*/
|
|
public 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;
|
|
}
|
|
public function getName()
|
|
{
|
|
return $_GET['qqfile'];
|
|
}
|
|
public function getSize()
|
|
{
|
|
if (isset($_SERVER['CONTENT_LENGTH'])) {
|
|
return (int)$_SERVER['CONTENT_LENGTH'];
|
|
} else {
|
|
throw new \Exception('Getting content length is not supported.');
|
|
}
|
|
}
|
|
}
|
|
|
|
// __END__
|