2009-05-16, 07:31 PM
Somewhere on the upload_attachment you can find the following code:
The double check always failed because $filename is different between the time that the file is written and the time of the "double check" because of this line:
For now I just comment out this line and it fixed the problem.
// All seems to be good, lets move the attachment!
$filename = "post_".$mybb->user['uid']."_".TIME_NOW."_".md5(uniqid(rand(),ן¿½true)).".attach";
//echo $filename."<br />";
$file = upload_file($attachment, $mybb->settings['uploadspath']."/".$month_dir, $filename);
// Failed to create the attachment in the monthly directory, just throw it in the main directory
if($file['error'] && $month_dir)
{
$file = upload_file($attachment, $mybb->settings['uploadspath'].'/', $filename);
}
if($month_dir)
{
$filename = $month_dir."/".$filename;
}
....
// Lets just double check that it exists
if(!file_exists($mybb->settings['uploadspath']."/".$filename))
{
$ret['error'] = $lang->error_uploadfailed.$lang->error_uploadfailed_detail.$lang->error_uploadfailed_lost;
return $ret;
}
The double check always failed because $filename is different between the time that the file is written and the time of the "double check" because of this line:
if($month_dir)
{
$filename = $month_dir."/".$filename;
}
For now I just comment out this line and it fixed the problem.