function managed_file_get_fid_by_uri in Managed File 7
Menu callback.
@internal
See also
1 string reference to 'managed_file_get_fid_by_uri'
- managed_file_menu in ./
managed_file.module - Implements hook_menu().
File
- includes/
managed_file.pages.inc, line 14 - Menu callbacks.
Code
function managed_file_get_fid_by_uri() {
$params = drupal_get_query_parameters();
if (isset($params['uri'])) {
$files = file_load_multiple([], $params);
if (empty($files)) {
$file = file_save_data(file_get_contents($params['uri']), $params['uri'], FILE_EXISTS_REPLACE);
if (FALSE !== $file) {
exit($file->fid);
}
}
exit(reset($files)->fid);
}
exit(0);
}