Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.