Hello, I'm working on my image upload script. I am trying to rename the file in the script to go in the database. I want it to be the name they choose plus 1, so: theirname1.jpg im trying to do something like $new_name = $name + 1; Code (markup): but it is not working. Does anyone know the right way? Thanks!
Or here a fancy one-liner that would work with double extensions too. $name = preg_replace('/(\.[a-z]{2,3})?\.[a-z]{2,5}$/i', '1$0', $name); PHP:
Never came across any... but this would work: $name = preg_replace('/(\.[a-z0-9]{2,3})?\.[a-z0-9]{2,5}$/i', '1$0', $name); PHP:
mp3, mp4 off the top of my head, I'm sure there are more, photoshop files ( plugins ) have numbers in thier extensions