Esempio n. 1
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/CFile.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/uploader/uploader.php";
session_start();
$resource = __paramInit('string', null, 'resource');
$action = __paramInit('string', null, 'action');
if ($resource) {
    switch ($action) {
        case 'create':
            if (is_array($_FILES['qqfile']) && !$_FILES['qqfile']['error']) {
                $result = uploader::listener($resource);
            } else {
                $result['success'] = false;
                switch ($_FILES['attachedfiles_file']['error']) {
                    case UPLOAD_ERR_FORM_SIZE:
                    case UPLOAD_ERR_INI_SIZE:
                        $result['error'] = "Максимальный объем файлов: " . ConvertBtoMB($max_files_size);
                        break;
                    default:
                        $result['error'] = "Ошибка загрузки файла.";
                        break;
                }
            }
            break;
        case 'remove':
            $files = __paramInit('array_int', null, 'files');
            uploader::sremoveFiles($resource, $files);
            $result['onComplete'] = uploader::getRemoveCallback(uploader::sgetTypeUpload($resource));
            $result['success'] = true;