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.'); } }
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(); break; case 'finish': print $bigUpload->finishUpload($_POST['name']); break; case 'post-unsupported': print $bigUpload->postUnsupported(); break; }