Jump to content

How Do I Rename The Image (Remove The Original Name)?


lovephp

Recommended Posts

guys i want to remove the original image name to name it to

 

$postData['ads_title'].$randomnum._.$removed_symbols;

 

 

		 adtitle    = '".$postData['ads_title']."',
           image    = '',
           postersname    = '".$postData['postersname']."',
           category     = '".$postData['category']."',
           adtype    = '".$postData['ads_type']."',
           state    = '".$postData['state']."',
           location    = '".$postData['ads_location']."',
           email     = '".$postData['email']."',
           phone    = '".$postData['phone']."',
           description    = '".$postData['description']."',
           adtime    = '".time()."'
           ";            
           executeSql($sql);
           }else{            
           global $uploadPath;
           $remove_symbols = array(' ', '%', '+', '=', '-', '{', '}', '$', '(', ')','&');
           $removed_symbols = str_replace($remove_symbols, "_", $_FILES['image']['name']);  
           $randomnum=rand(00000000,99999999);  
           $imagepath = uploadFile($_FILES['image'], $uploadPath);
           $image = new SimpleImage();
           $image->load($imagepath);
           $image->resize(250,280);
           $resize_rename = $uploadPath.$randomnum._.$removed_symbols;
           $image->save($resize_rename);                                    
           unlink($imagepath); //delete the original file                        
           $sql = " INSERT INTO tbl_ne_ads SET
           adtitle    = '".$postData['ads_title']."',
           image    = '".$resize_rename."',

what i am asking is when i upload image currently it gets uploaded as 2837445546_originalimagename.jpg but what i want is change the image name to the $postData['ads_title'] which is being entered in the input text field by user , basically image should be named like 3242342_Some_Title.jpg

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.