Author: acydburn
Date: Tue Sep 8 15:02:40 2009
New Revision: 10122
Log:
Always remove temporary filename (Bug #50965)
Modified:
branches/phpBB-3_0_0/phpBB/includes/functions_upload.php
Modified: branches/phpBB-3_0_0/phpBB/includes/functions_upload.php
==============================================================================
*** branches/phpBB-3_0_0/phpBB/includes/functions_upload.php (original)
--- branches/phpBB-3_0_0/phpBB/includes/functions_upload.php Tue Sep 8 15:02:40 2009
***************
*** 313,324 ****
if (!@move_uploaded_file($this->filename, $this->destination_file))
{
$this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file);
- return false;
}
}
- @unlink($this->filename);
-
break;
case 'move':
--- 313,321 ----
***************
*** 328,339 ****
if (!@copy($this->filename, $this->destination_file))
{
$this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file);
- return false;
}
}
- @unlink($this->filename);
-
break;
case 'local':
--- 325,333 ----
***************
*** 341,354 ****
if (!@copy($this->filename, $this->destination_file))
{
$this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file);
- return false;
}
- @unlink($this->filename);
break;
}
phpbb_chmod($this->destination_file, $chmod);
}
// Try to get real filesize from destination folder
--- 335,355 ----
if (!@copy($this->filename, $this->destination_file))
{
$this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file);
}
break;
}
+ // Remove temporary filename
+ @unlink($this->filename);
+
+ if (sizeof($this->error))
+ {
+ return false;
+ }
+
phpbb_chmod($this->destination_file, $chmod);
+ return true;
}
// Try to get real filesize from destination folder
|