Page 1 of 1

Overwrite if file_exists();

Posted: Tue Mar 21, 2006 8:47 am
by $var
When uploading a file to a directory where it already exists,
is there a way to overwrite the file with the same name?

I figure as much that it will be with file_exists();

I found an example of how to rename a file, but nothing to really name overtop of a file.
Woud that be a procedure like:

if file exists, delete file then copy file?

or is there a setting to use?

Posted: Tue Mar 21, 2006 10:06 am
by feyd
you'll need to delete the existing file, yes. unlink()