Index: modules/imce/imce.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imce/imce.module,v retrieving revision 1.6 diff -u -r1.6 imce.module --- modules/imce/imce.module 29 Sep 2006 13:50:57 -0000 1.6 +++ modules/imce/imce.module 1 Oct 2006 21:16:12 -0000 @@ -138,7 +138,16 @@ return false; } + //move uploaded file to drupal's temp directory + $temp = tempnam(file_directory_temp(), 'tmp_'); + if (!move_uploaded_file($file['tmp_name'], $temp)) { + drupal_set_message(t('File upload error. Could not move uploaded file.')); + return false; + } + $file['tmp_name'] = $temp; + //dont like too long filenames and files without an extension. + $file['name'] = trim(basename($file['name']), '.'); if (strlen($file['name'])>32) { drupal_set_message(t('Filename is too long(>32 chars).'), 'error'); return false; @@ -161,11 +170,11 @@ $maxh = variable_get('imce_max_height', 500); if ($info[0]>$maxw || $info[1]>$maxh) { if (variable_get('imce_resizing', 0) && $_POST['resize']) { - if(!image_scale($file['tmp_name'], $file['tmp_name'].$file['name'], $maxw, $maxh)) { + if(!image_scale($file['tmp_name'], $file['tmp_name'], $maxw, $maxh)) { drupal_set_message(t('Error scaling image.'), 'error'); return false; } - $file['tmp_name'] .= $file['name'];//new name + clearstatcache(); $file['size'] = filesize($file['tmp_name']);//new size drupal_set_message(t('Image was scaled to allowed dimensions.')); }