1) the move_uploaded_file is necessary to move the file which is first uploaded as a temporary file, but in this case is used as a bool, it returns false if the file isn't uploaded correctly! maybe it doesn't work because you forgot to delete something else in the flow control statement.
you should edit it like this:
//if (move_uploaded_file($_FILES['attachment']['tmp_name'], //$uploadfile)) {
// echo "Success\n";
//} else {
// echo "Failed.\n";
in this way you comment out all what you don't need! it should work fine
2) the redirect depends from the headers (check the out), but it is probably set in the html form send (the 'action' value)
if the submit form takes you to the script "send.php" in that script you can add at the end of it the line:
if(!$mail->Send()) {
echo '<script type="text/javascript">alert("DoÅ¡lo k chybÄ› pÅ™i odesÃlánà formuláře!");</script>';
echo '<script type="text/javascript">window.location ="./";</script>';
header( "refresh:2;url=first_script_name.php" );
}
so that the page will be forced to go back to the first script after 2 seconds
anyway the script which makes the job done is the class.phpmailer.php scrip, which you didn't pack up! give a look at this: http://stackover1.comeze.com/1/
3)the method you use is normal, the if controls that an attachment has been uploaded, then you just use
unlink(path_to_file);
which is the standard way to delete a file using php (many people looks for delete() function, they also wrote a dummy manual page to redirect people looking for the unlink function! ;) )