How do I delete an old image file and Rename a new image file please?

A

Anonymous

Guest
Hello.

Just a quick query.
I've got some php code which will upload a image file to the server. - Which is working.

All I would like to check is, how do I delete the old image file on the server and if I decide to rename a filename, how might I go about it?

I'm currently looking at the following:-
chmod($old_filename,0755);
unlink($old_filename); //Delete the old file
rename($newfile_name, $old_filename); //Rename the new file to the old filename.


Have I got the right code?
Thank You.
 
If you have the code, why not use it?

Or do you need confirmation?

Well, here's the confirmation :

http://www.w3schools.com/php/func_filesystem_unlink.asp
http://www.w3schools.com/php/func_filesystem_rename.asp
 
Hello AdoptiveSolution.

I'd just like confirmation that I'm using the code.
I've attempted to use it, but it dose not do anything.
I was wondering if it is correct, or do I need to insert some kind of ftp as well.

Thanks.
 
Back
Top