function imagepicker_copy_uploaded_file in Image Picker 5.2
Same name and namespace in other branches
- 5 imagepicker.module \imagepicker_copy_uploaded_file()
- 6.2 imagepicker.upload.inc \imagepicker_copy_uploaded_file()
- 7 imagepicker.upload.inc \imagepicker_copy_uploaded_file()
1 call to imagepicker_copy_uploaded_file()
- imagepicker_upload_form_submit in ./
imagepicker.module - Submit upload form
File
- ./
imagepicker.module, line 512 - Enables permitted roles to upload images for insertion into configured nodes.
Code
function imagepicker_copy_uploaded_file(&$destination, $name) {
$source = $_FILES['files']['tmp_name'][$name];
if (file_copy($source, $destination, FILE_EXISTS_RENAME)) {
// Fix bug in drupal's file_copy function which uses '/' instead of
// DIRECTORY_SEPARATOR for making directories. This causes problems on
// Windows mashines.
$source = str_replace('/', DIRECTORY_SEPARATOR, $source);
$file = imagepicker_get_uploaded_file_name($destination, $name);
$destination = $destination . $file;
return @rename($source, $destination);
}
return FALSE;
}