示例#1
0
        } else {
            return 'There was an error uploading the file';
        }
    }
}
require __DIR__ . '/../../Publish/lib/service/ModuleService.php';
$module = new ModuleService();
$upload_path = '../../publishModules/upload/';
if ($module->isWritableConfig()) {
    $configs = $module->getConfig();
    if (isset($configs['path']['upload_path'])) {
        $upload_path = $configs['path']['upload_path'];
    }
}
//Instantiate the class
$bigUpload = new BigUpload($upload_path);
//Set the temporary filename
$tempName = null;
if (isset($_GET['key'])) {
    $tempName = $_GET['key'];
}
if (isset($_POST['key'])) {
    $tempName = $_POST['key'];
}
$bigUpload->setTempName($tempName);
switch ($_GET['action']) {
    case 'upload':
        print $bigUpload->uploadFile();
        break;
    case 'abort':
        print $bigUpload->abortUpload();
function main($action, $tempName, $finalFileName, $files)
{
    // Instantiate the class
    $bigUpload = new BigUpload();
    $bigUpload->setTempName($tempName);
    switch ($action) {
        case 'upload':
            return $bigUpload->uploadFile();
        case 'abort':
            return $bigUpload->abortUpload();
        case 'finish':
            return $bigUpload->finishUpload($finalFileName);
        case 'post-unsupported':
        case 'vanilla':
            return $bigUpload->postUnsupported($files);
        case 'help':
            return array('errorStatus' => 552, 'errorText' => "You've reached the BigUpload gateway. Machines will know what to do.");
        default:
            return array('errorStatus' => 550, 'errorText' => 'Unknown action. Internal failure.');
    }
}
示例#3
0
    {
        $name = $_FILES['bigUploadFile']['name'];
        $size = $_FILES['bigUploadFile']['size'];
        $tempName = $_FILES['bigUploadFile']['tmp_name'];
        if (filesize($tempName) > self::MAX_SIZE) {
            return 'File is too large.';
        }
        if (move_uploaded_file($tempName, $this->getMainDirectory() . $name)) {
            return 'File uploaded.';
        } else {
            return 'There was an error uploading the file';
        }
    }
}
//Instantiate the class
$bigUpload = new BigUpload();
//Set the temporary filename
$tempName = null;
if (isset($_GET['key'])) {
    $tempName = $_GET['key'];
}
if (isset($_POST['key'])) {
    $tempName = $_POST['key'];
}
$bigUpload->setTempName($tempName);
switch ($_GET['action']) {
    case 'upload':
        print $bigUpload->uploadFile();
        break;
    case 'abort':
        print $bigUpload->abortUpload();