You are here

function imagepicker_postlet_get_uploaded_file_name in Image Picker 6.2

1 call to imagepicker_postlet_get_uploaded_file_name()
imagepicker_postlet_copy_uploaded_file in contribs/imagepicker_postlet/imagepicker_postlet.module

File

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

Code

function imagepicker_postlet_get_uploaded_file_name($destination) {
  $file = $_FILES['userfile']['name'];
  $fileext = imagepicker_postlet_get_uploaded_file_extension($file);
  if (FALSE !== strpos($file, '.')) {
    $filename = drupal_substr($file, 0, strrpos($file, '.'));
  }
  else {
    $filename = $_FILES['userfile']['name'];
  }
  $file = $filename . $fileext;
  $i = 0;
  while (file_exists($destination . $file)) {
    $i++;
    $file = $filename . '_' . $i . $fileext;
  }
  return $file;
}