Related topics
- File interface
- Common file handling functions.
File
- includes/file.inc, line 581
- API for handling file uploads and server file management.
Code
function file_download() {
$args = func_get_args();
$filepath = implode('/', $args);
if (isset($_GET['file'])) {
$filepath = $_GET['file'];
}
if (file_exists(file_create_path($filepath))) {
$headers = module_invoke_all('file_download', $filepath);
if (in_array(-1, $headers)) {
return drupal_access_denied();
}
if (count($headers)) {
file_transfer($filepath, $headers);
}
}
return drupal_not_found();
}
Login or
register to post comments