/** * File used to handle file downloads * * This file handles the downloading and resuming of file downloads while keeping user permissions in mind. * * @author Perfler Dominik <*****@*****.**> * @copyright 2014-2015 Perfler Dominik * @license MIT */ if (http_response_code() == 503) { Lightwork::Done(503, 'ERROR_SITE_OFFLINE'); } else { if (http_response_code() == 500) { Lightwork::Done(500, 'ERROR_FILE_SERVER_ERROR'); } else { $file = Lightwork::File(); // Aquire the file if (isset($file['status']) && isset($file['message'])) { // Check if we have an error case Lightwork::Done($file['status'], $file['message']); } else { if (is_file(FILES_DIR . $file['path'])) { $name = basename($file['path']); // Get the name of the file $offset = 0; // The offset at which the file will be read $size = filesize(FILES_DIR . $file['path']); // The total size of the file $length = $size; // The actual length of the download range header('Content-Length: ' . $size);