You are here

function imagepicker_postlet_copy_uploaded_file in Image Picker 6.2

1 call to imagepicker_postlet_copy_uploaded_file()
imagepicker_postlet_do in contribs/imagepicker_postlet/imagepicker_postlet.module
Function to process the postlet applet callbacks

File

contribs/imagepicker_postlet/imagepicker_postlet.module, line 330
Enables upload of images using Postlet java applet. http://www.postlet.com/ http://sourceforge.net/projects/postlet/

Code

function imagepicker_postlet_copy_uploaded_file(&$destination) {
  $source = $_FILES['userfile']['tmp_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_postlet_get_uploaded_file_name($destination);
    $destination = $destination . $file;
    return @rename($source, $destination);
  }
  return FALSE;
}