trying diiferent Attachment ID-ing Method, as getRandomString seems to produce non Random String on certain systems

This commit is contained in:
Klaus Leithoff 2009-10-06 14:13:42 +00:00
parent 414c1831ab
commit dd8b6720af

View File

@ -102,21 +102,28 @@
if (is_uploaded_file($_formData['file'])) if (is_uploaded_file($_formData['file']))
{ {
//error_log(__METHOD__." Uploaded File:".$_formData['file']." with filesize:".filesize($_formData['file']));
move_uploaded_file($_formData['file'],$tmpFileName); // requirement for safe_mode! move_uploaded_file($_formData['file'],$tmpFileName); // requirement for safe_mode!
//error_log(__METHOD__." copy to :".$tmpFileName." with filesize:".filesize($tmpFileName));
} }
else else
{ {
rename($_formData['file'],$tmpFileName); rename($_formData['file'],$tmpFileName);
} }
$attachmentID = $this->getRandomString(); //$attachmentID = $this->getRandomString();
//error_log(__METHOD__." add Attachment with ID (random String):".$attachmentID);
$this->sessionData['attachments'][$attachmentID]=array $buffer=array
( (
'name' => $_formData['name'], 'name' => $_formData['name'],
'type' => $_formData['type'], 'type' => $_formData['type'],
'file' => $tmpFileName, 'file' => $tmpFileName,
'size' => $_formData['size'] 'size' => $_formData['size']
); );
// trying diiferent ID-ing Method, as getRandomString seems to produce non Random String on certain systems.
$attachmentID = md5(time().serialize($buffer));
//error_log(__METHOD__." add Attachment with ID:".$attachmentID." (md5 of serialized array)");
$this->sessionData['attachments'][$attachmentID] = $buffer;
unset($buffer);
} }
$this->saveSessionData(); $this->saveSessionData();