upload_file_download
modules/upload/upload.module, строка 146
- Версии
- 5
upload_file_download(
$file)- 6
upload_file_download($filepath)
Implementation of hook_file_download()
.
Код
<?php
function upload_file_download($filepath) {
$filepath = file_create_path($filepath);
$result = db_query("SELECT f.*, u.nid FROM {files} f INNER JOIN {upload} u ON f.fid = u.fid WHERE filepath = '%s'", $filepath);
if ($file = db_fetch_object($result)) {
if (user_access('view uploaded files') && ($node = node_load($file->nid)) && node_access('view', $node)) {
return array(
'Content-Type: ' . $file->filemime,
'Content-Length: ' . $file->filesize,
);
}
else {
return -1;
}
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии