Posted by Sjoerd on 12/05/47 11:48
Dynamo wrote:
> I am trying to upload a file and then rename the file as something else.
> Everything worked fine unless the renamed filename already existed.
Are you sure? The documentation for move_uploaded_file says:
> If the destination file already exists, it will be overwritten.
You can do an unlink and then move the file, even if the destination
does not exist:
@unlink($destination);
move_uploaded_file($source, $destination);
The @ is there to avoid any errors if the $destination file does not
exist.
Navigation:
[Reply to this message]
|