public function upload() { // активное правило загрузки для файла $rules_name = joosRequest::post('rules_name'); joosUpload::init($rules_name); $upload_result = array(); $check = joosUpload::check(); if ($check === true) { $upload_result = joosUpload::actions_before() + $upload_result; $upload_result = joosUpload::easy_upload(joosUpload::get_input_name(), joosUpload::get_upload_location()) + $upload_result; $upload_result = joosUpload::actions_after($upload_result) + $upload_result; // удаляем физически файл если проверки не прошли в пользователю выдаём ошибку if ($upload_result['success'] !== true) { joosFile::delete($upload_result['file_base_location']); } } else { $upload_result = $check; } // подчищаем секретные данные unset($upload_result['file_base_location']); return $upload_result; }
public function upload() { $upload_result = joosUpload::easy_upload('qqfile', JPATH_BASE . '/cache/tmp/'); return $upload_result + array('success' => $upload_result['success']); }
/** * Загрузка файлов для текстов материалов (через визуальный редактор) * Грузятся в /attachments/files_embedded */ public static function upload_files_embedded() { $upload_result = joosUpload::easy_upload('file', JPATH_APP_BASE . '/attachments/files_embedded/', array('new_name' => date('YmdHis'))); echo '<a href="' . $upload_result['file_live_location'] . '" class="redactor_file_link redactor_file_ico_' . $upload_result['file_info']['ext'] . '">' . $upload_result['file_name'] . '</a>'; }