
 Said Bakr - 2008-04-08 23:58:33
Hi,
The property file_overwrite when set to true should lead to overwrite the new prcessed file if there is a file with the same name. The situation I found that it keeps trailing the new file name with _x where x is an integer. Is using file_new_name_body make a confilict?
Here is the code:
function upImage($dest,$frmFld,$name){
global $siteAbsPath;
require($siteAbsPath.'/scripts/class.upload.php');
$handle = new upload($_FILES[$frmFld]);
 
if ($handle->uploaded){
$handle->file_overwrite = true;
$handle->file_new_name_body   = $name;
$handle->image_resize         = true;
$handle->allowed = array('image/*');
$handle->file_max_size = '21000';
$handle->image_x              = 60;
$handle->image_ratio_y        = true; 
	 
      $handle->process($dest);
	
      if ($handle->processed) {          
          $handle->clean();
		  //die();
		  return true;
      } else {
          die( 'error : ' . $handle->error);
      }
}
}