예제 #1
0
파일: chunk.php 프로젝트: anteknik/arsip
$gateKeeper = new GateKeeper();
if ($gateKeeper->isAccessAllowed() && $gateKeeper->isAllowed('upload_enable')) {
    if ($_SERVER['REQUEST_METHOD'] === 'GET') {
        if ($_GET['resumableChunkNumber'] == 1) {
            $firstChunk = true;
        } else {
            $firstChunk = false;
        }
        $resumabledata = $chunk->setupFilename($_GET['resumableFilename'], $_GET['resumableIdentifier']);
        $resumableFilename = $resumabledata['filename'];
        $extension = $resumabledata['extension'];
        $basename = $resumabledata['basename'];
        $fullfilepath = $_GET['loc'] . $resumableFilename;
        if (Utils::notList($extension, SetUp::getConfig("upload_allow_type")) == true || Utils::inList($extension, SetUp::getConfig("upload_reject_extension")) == true || Utils::inList($resumableFilename, array('.htaccess', '.htpasswd', '.ftpquota')) == true || substr($resumableFilename, 0, 1) === ".") {
            if ($_GET['resumableChunkNumber'] == 1) {
                $chunk->setError("<span><i class=\"fa fa-exclamation-triangle\"></i> " . $basename . "<strong>." . $extension . "</strong> " . SetUp::getLangString("upload_type_not_allowed") . "</span> ");
            }
            header("HTTP/1.0 200 Ok");
        } elseif (file_exists($fullfilepath)) {
            if ($_GET['resumableChunkNumber'] == 1) {
                $chunk->setWarning(" <span><i class=\"fa fa-info-circle\"></i> <strong>" . $resumableFilename . "</strong> " . SetUp::getLangString("file_exists") . "</span> ");
            }
            header("HTTP/1.0 200 Ok");
        } elseif ($chunk->checkUserUp($_GET['resumableTotalSize']) == false) {
            if ($_GET['resumableChunkNumber'] == 1) {
                $chunk->setError("<span><i class=\"fa fa-exclamation-triangle\"></i>" . " <strong>" . SetUp::getLangString("upload_exceeded") . "</strong>: " . $_GET['resumableFilename'] . "</span> ");
            }
            header("HTTP/1.0 200 Ok");
        } else {
            $temp_dir = 'tmp/' . $_GET['resumableIdentifier'];
            $chunk_file = $temp_dir . '/' . $_GET['resumableFilename'] . '.part' . $_GET['resumableChunkNumber'];