Skip to content

Commit

Permalink
1. Added code to check for file upload errors related to attachments
Browse files Browse the repository at this point in the history
2. Changed the code to not only display the error after submit but to redirect
to the previous step
  • Loading branch information
nicdev007 committed Oct 22, 2009
1 parent e4be0dd commit f8e2b4e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions incident_email.php
Expand Up @@ -641,6 +641,13 @@ function save_content(){
$errors = 1;
$error_string .= "<p class='error'>".sprintf($strFieldMustNotBeBlank, $strReplyTo)."</p>\n";
}
$errorcode = $_FILES['attachment']['error'];
// check the for errors related to file size in php.ini(upload_max_filesize) TODO: Should i18n this..
if ($errorcode == 1 || $errorcode == 2)
{
$errors = 1;
$error_string .= "<p>".get_file_upload_error_message($_FILES['attachment']['error'], $_FILES['attachment']['name'])."</p>\n";
}
// Store email body in session if theres been an error
if ($errors > 0) $_SESSION['temp-emailbody'] = $bodytext;
else unset($_SESSION['temp-emailbody']);
Expand Down Expand Up @@ -894,9 +901,7 @@ function confirm_close_window()
else
{
// there were errors
include (APPLICATION_INCPATH . 'incident_html_top.inc.php');
echo $error_string;
include (APPLICATION_INCPATH . 'incident_html_bottom.inc.php');
html_redirect("incident_email.php?id={$id}&step=2&draftid={$draftid}", FALSE, $error_string);
}
break;

Expand Down

0 comments on commit f8e2b4e

Please sign in to comment.