Page 1 of 1

how to add variable to filename

Posted: Sat Aug 09, 2008 3:41 pm
by lcramer
How can I 'rename' a file that php is uploading by inserting the 'label' (from the form) 'name'?

ex: uploaded file original name = wedding1.jpg
name label = jane doe

renamed uploaded file saved to server would = wedding1janedoe.jpg

What code would I have to put in to the php script?

Any help, thank you!
L

Re: how to add variable to filename

Posted: Sat Aug 09, 2008 6:18 pm
by pickle
strip the extension (strrpos() might help there), add what you want, then tack the extension back on.