exit; } } } } echo json_encode(array('error' => 'There was a problem uploading your file')); exit; } else { if ($mod && $mod === 'download') { $id = isset($_GET['id']) ? $_GET['id'] : false; if ($id) { $file = new File(array('file_id' => $id, '_user_id' => $user->getAttribute('user_id'))); if ($file->loadByAttributes()) { header('Cache-Control: public'); header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename=' . $file->getAttribute('name')); header('Content-Type: ' . $file->getAttribute('mime_type')); header('Content-Transfer-Encodeing: binary'); readfile($file->getAttribute('location')); exit; } } header('HTTP/1.0 404 Not Found'); exit; } else { $renderer->setTitle('Your stuff'); $renderer->setKeywords(array('your', 'stuff', 'here')); $renderer->addScript('scripts/upload.js'); $renderer->addScript('scripts/json_parse.js'); $renderer->addContent('dashboard.tpl', array('files' => $files->getElements(), 'token' => $_SESSION['token'], 'filesCount' => count($files->getElements()))); }