On Aug 3, 2009, at 7:04 AM, seb <sebastian@xxxxxxxxxxxxxx> wrote:
Hey all,
i am using move_upload function to upload files to the server, but i
want to add a feature that will allow files to be archived that have
been uploaded already.
so, the problem is:
i upload a file that i want to "upgrade" and move the old file to an
archive directory but I want to verify the NEW file is upload BEFORE
moving the old file (the file being uploaded might not have the same
filename as the old file currently on the server)..
i want to move the old file only when the new file was successfully
uploaded. something like:
only one problem.. then if both files have the same name it will be
overwritten before it moves the old one i want to save. if i move
the old one first, there still the possibility of the new upload
failing so i am back to square one..
i guess i can move_upload to a different directory, verify it's been
uploaded, move the old to the archive file, then move the new file
back to where it should be (where the archive file was)..
is that my only option? any suggestions?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Do an check for the file before moving it
If(file_exists($filename)){
// copy file out to archive
}
}if(move_uploaded_file(....))
{
}
Bastien
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php