function angular_media_file_uri_to_object in CKEditor Widgets 7
Returns a file object which can be passed to file_save().
@todo Replace with calls to this function with file_uri_to_object() when http://drupal.org/node/685818 is fixed in core.
Parameters
string $uri: A string containing the URI, path, or filename.
Return value
boolean A file object, or FALSE on error.
File
- ./
angular_media.module, line 343 - Implementation of angular_media.module.
Code
function angular_media_file_uri_to_object($uri) {
global $user;
$uri = file_stream_wrapper_uri_normalize($uri);
$wrapper = file_stream_wrapper_get_instance_by_uri($uri);
$file = new StdClass();
$file->uid = $user->uid;
$file->filename = drupal_basename($uri);
$file->uri = $uri;
$file->filemime = file_get_mimetype($uri);
// This is gagged because some uris will not support it.
$file->filesize = @filesize($uri);
$file->timestamp = REQUEST_TIME;
$file->status = FILE_STATUS_PERMANENT;
return $file;
}