How to have php rename a file?

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
Rickpo12
Forum Newbie
Posts: 4
Joined: Sun Mar 07, 2010 10:24 pm

How to have php rename a file?

Post by Rickpo12 »

How to you have php execute OS commands like mv to move a file from one directory to another. I want this to happen when the end user clicks on the submit button on a web page?
Thank you.

Rick
Rickpo12
Forum Newbie
Posts: 4
Joined: Sun Mar 07, 2010 10:24 pm

Re: How to have php rename a file?

Post by Rickpo12 »

Answered my own question.

rename('/path1/old_filename', '/path2/new_filename');

Rick
Post Reply