function scald_plupload_save_file in Scald: Media Management made easy 7
Creates a file object at the proper place when uploading with plupload.
5 calls to scald_plupload_save_file()
- hook_scald_add_form_fill in ./
scald.api.php - Fills default atom data.
- scald_audio_scald_add_form_fill in modules/
providers/ scald_audio/ scald_audio.module - Implements hook_scald_add_form_fill().
- scald_flash_scald_add_form_fill in modules/
providers/ scald_flash/ scald_flash.module - Implements hook_scald_add_form_fill.
- scald_image_scald_add_form_fill in modules/
providers/ scald_image/ scald_image.module - Implements hook_scald_add_form_fill().
- scald_video_get_video_file in modules/
providers/ scald_video/ scald_video.module - Saves a video file from a form's file value.
File
- includes/
scald.plupload.inc, line 10 - Plupload integration helper functions.
Code
function scald_plupload_save_file($tmppath, $target) {
$tmp = plupload_file_uri_to_object($tmppath);
// Changing file mime to the proper one.
$tmp->filemime = file_get_mimetype($target);
$tmp->status = 0;
$destination = dirname($target);
if (!file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) {
watchdog('file', 'The upload directory %directory could not be created or is not accessible.', array(
'%directory' => $destination,
));
return FALSE;
}
return file_move($tmp, $target, FILE_EXISTS_RENAME);
}