You are here

function imagepicker_file_unmanaged_move in Image Picker 7

2 calls to imagepicker_file_unmanaged_move()
imagepicker_copy_uploaded_file in ./imagepicker.upload.inc
imagepicker_reallocate_image in ./imagepicker.admin.inc

File

./imagepicker.functions.inc, line 3069
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function imagepicker_file_unmanaged_move($s, $d, $r = FILE_EXISTS_RENAME) {

  // file_unmanaged_move does not check for trailing slashes
  $d = rtrim($d, DIRECTORY_SEPARATOR);
  $n = file_unmanaged_move($s, $d, $r);
  if ($n) {

    // Fix bug in drupal's file_copy function which uses '/' instead of
    // DIRECTORY_SEPARATOR for making directories. This causes problems on
    // Windows machines. still true in D7
    $n2 = preg_replace("#^" . IMAGEPICKER_FILE_SCHEME . "#", '', $n);
    $n2 = str_replace('/', DIRECTORY_SEPARATOR, $n2);
    $n = IMAGEPICKER_FILE_SCHEME . $n2;
  }
  return $n;
}