attachment error checking
This commit is contained in:
parent
efadbb3f58
commit
0b579f6306
1 changed files with 15 additions and 4 deletions
|
@ -620,15 +620,26 @@ class Ticket{
|
||||||
$ticket->load_With_TId($TId);
|
$ticket->load_With_TId($TId);
|
||||||
|
|
||||||
//create the attachment!
|
//create the attachment!
|
||||||
$dbl = new DBLayer("lib");
|
try {
|
||||||
$dbl->insert("`ticket_attachments`", Array('ticket_TId' => $TId, 'Filename' => $filename, 'Filesize' => filesize($tempFile), 'Uploader' => $author, 'Path' => $randomString . "/" . $filename));
|
$dbl = new DBLayer("lib");
|
||||||
|
$dbl->insert("`ticket_attachments`", Array('ticket_TId' => $TId, 'Filename' => $filename, 'Filesize' => filesize($tempFile), 'Uploader' => $author, 'Path' => $randomString . "/" . $filename));
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
return $false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mkdir($FILE_STORAGE_PATH . $randomString);
|
mkdir($FILE_STORAGE_PATH . $randomString);
|
||||||
move_uploaded_file($tempFile,$targetFile);
|
$return = move_uploaded_file($tempFile,$targetFile);
|
||||||
|
|
||||||
|
if ($return == false) {
|
||||||
|
$dbl->delete("`ticket_attachments`", array('Path' => $randomString . "/" . $filename), "`Path` = :Path");
|
||||||
|
}
|
||||||
|
|
||||||
//write a log entry
|
//write a log entry
|
||||||
Ticket_Log::createLogEntry( $TId, $author, 10);
|
Ticket_Log::createLogEntry( $TId, $author, 10);
|
||||||
|
|
||||||
return true;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue