Rename file upload based on input

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amijic
Forum Newbie
Posts: 3
Joined: Thu Jan 26, 2012 11:07 pm

Rename file upload based on input

Post 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.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Rename file upload based on input

Post by Celauran »

Take a look at move_uploaded_file()
amijic
Forum Newbie
Posts: 3
Joined: Thu Jan 26, 2012 11:07 pm

Re: Rename file upload based on input

Post 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.
G l a z z
Forum Newbie
Posts: 24
Joined: Sun Feb 12, 2012 10:33 pm

Re: Rename file upload based on input

Post by G l a z z »

The move_uploaded_file() function does exactly what you want.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Rename file upload based on input

Post 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.
Post Reply