$cleanupTargetDir not correctly implemented in upload.php. Closes #699.