function return_files_for_item($options = array(), $wrapperAttributes = array('class' => 'item-file'), $item = null) { if (!$item) { $item = get_current_record('item'); } return return_files($item->Files, $options, $wrapperAttributes); }
<?php $project = isset($_GET['project']) ? $_GET['project'] : 'test'; if (!is_dir('./projects/' . $project)) { $old_umask = umask(0); mkdir('./projects/' . $project, 0777); umask($old_umask); } if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'GET') { if (isset($_GET['download']) && $_GET['download'] == true) { download_as_zip($project); } else { return_files($project); } } if (isset($_GET['upload']) && $_GET['upload'] == true) { save_uploaded_file($project); } else { if (isset($_GET['delete']) && $_GET['delete'] == true) { delete_file($project); } } // copy&pasted from http://php.net/manual/en/features.file-upload.php function save_uploaded_file($project) { $max_filesize = 500 * 1024 * 1024; try { $file = $_FILES['file']; if (!isset($file['error'])) { throw new RuntimeException('File not defined.'); }