Page 1 of 1

Rename file upload based on input

Posted: Wed Feb 15, 2012 8:34 am
by amijic
Hi All,

I am trying to create an upload file form that has three fields. the first field will have the user's last name and the second field will be a drop down menu with a couple of selections.

What I want to happen is that when the user clicks on the submit button, I want the file to be uploaded and the file name changed to whatever they had in teh first 2 fields (ie. lastname+dropdownSelection.extension)

Any help is greatly appreciated as I am very new to php.

Re: Rename file upload based on input

Posted: Wed Feb 15, 2012 8:38 am
by Celauran
Take a look at move_uploaded_file()

Re: Rename file upload based on input

Posted: Wed Feb 15, 2012 10:45 am
by amijic
Don't see how that is supposed to help me out?

Not trying to move file, I am trying to rename it based on input.

Re: Rename file upload based on input

Posted: Wed Feb 15, 2012 10:53 am
by G l a z z
The move_uploaded_file() function does exactly what you want.

Re: Rename file upload based on input

Posted: Wed Feb 15, 2012 11:22 am
by Celauran
amijic wrote:Not trying to move file, I am trying to rename it based on input.
Renaming a file and moving a file is the same thing.