ohdang888 Posted May 2, 2008 Share Posted May 2, 2008 how do i rename the file... this is my script so far.. $random_digit=rand(000000000000000,999999999999999); $target_path = $target_path . $random_digit . basename( $_FILES['uploadedfile']['name']); but say i upload "pic.jpg" it just turns it in "441561618575641pic.jpg" i want to get rid of the "pic" part... thanks! Link to comment https://forums.phpfreaks.com/topic/103914-rename-uploaded-file/ Share on other sites More sharing options...
ohdang888 Posted May 2, 2008 Author Share Posted May 2, 2008 NVM, solved it... Link to comment https://forums.phpfreaks.com/topic/103914-rename-uploaded-file/#findComment-531985 Share on other sites More sharing options...
Caesar Posted May 2, 2008 Share Posted May 2, 2008 You can grab the extension and just add your random filename to it: <?php $xtenshun = substr($str, strrpos($str, ".")); ?> Link to comment https://forums.phpfreaks.com/topic/103914-rename-uploaded-file/#findComment-531995 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.