lovephp Posted October 29, 2012 Share Posted October 29, 2012 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."', Quote Link to comment https://forums.phpfreaks.com/topic/270037-how-do-i-rename-the-image-remove-the-original-name/ Share on other sites More sharing options...
Beeeeney Posted October 29, 2012 Share Posted October 29, 2012 Now it might be where I'm tired, but I literally have no idea what you're asking. Quote Link to comment https://forums.phpfreaks.com/topic/270037-how-do-i-rename-the-image-remove-the-original-name/#findComment-1388479 Share on other sites More sharing options...
lovephp Posted October 29, 2012 Author Share Posted October 29, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/270037-how-do-i-rename-the-image-remove-the-original-name/#findComment-1388482 Share on other sites More sharing options...
lovephp Posted October 29, 2012 Author Share Posted October 29, 2012 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/270037-how-do-i-rename-the-image-remove-the-original-name/#findComment-1388499 Share on other sites More sharing options...
MDCode Posted October 29, 2012 Share Posted October 29, 2012 (edited) $resize_rename = $uploadPath.$randomnum._.$removed_symbols; To be honest your code looks very messy. I believe you would edit this line but I have no idea what you're doing to it Edited October 29, 2012 by ExtremeGaming Quote Link to comment https://forums.phpfreaks.com/topic/270037-how-do-i-rename-the-image-remove-the-original-name/#findComment-1388524 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.