| 5 file.inc | file_create_url($path) |
| 6 file.inc | file_create_url( |
| 7 file.inc | file_create_url($uri) |
| 8 file.inc | file_create_url($uri) |
Create the download path to a file.
Parameters
$path Path to the file to generate URL for:
Return value
URL pointing to the file
Related topics
5 calls to file_create_url()
File
- includes/
file.inc, line 30 - API for handling file uploads and server file management.
Code
function file_create_url($path) {
if (strpos($path, variable_get('file_directory_path', 'files')) !== false) {
$path = trim(substr($path, strlen(variable_get('file_directory_path', 'files'))), '\\/');
}
switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
case FILE_DOWNLOADS_PUBLIC:
return $GLOBALS['base_url'] . '/' . variable_get('file_directory_path', 'files') . '/' . str_replace('\\', '/', $path);
case FILE_DOWNLOADS_PRIVATE:
return url('system/files', 'file=' . $path, NULL, TRUE);
}
}
Login or register to post comments