I have tested it more than once, and if the total file size is bigger than the allowed size, there will be a red message inform me that the file size is too big.
It is weird to know you did not work whereas mine worked properly, moreover the related code that verify the file size located on the same place with the extention verification code. :
Sincerely,
Masino Sinaga
I know that it is strange. I have tested it with two attachments. One small picture and a big picture (bigger than allowed). I was able to submit the ticket and at the top of the "Support ticket request created" page I saw the message "Uploaded Sunset.jpg.Error Upload failed 103418706c2653_46_1.jpg - Try again.". With the wrong extension the "invalid file type" message is shown correctly in red on the submit page. I am not sure what is wrong but it would be really nice if you could take a look at it.
My open.php looks like this:
<?php
/*********************************************************************
open.php
New tickets handle.
Peter Rotich <peter@osticket.com>
Copyright (c) 2006,2007,2008,2009 osTicket
http://www.osticket.com(http://www.osticket.com)
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
$Id: $
**********************************************************************/
require('client.inc.php');
define('SOURCE','Web'); //Ticket source.
$inc='open.inc.php'; //default include.
$errors=array();
if($_POST):
$_POST=$_POST=0; //Just Making sure we don't accept crap...only topicId is expected.
//Ticket:...checks for errors..
$totalsize=0;
foreach($_FILES as $file) {
if ($file!='') {
if(!$cfg->canUploadFileType($file)) {
$errors .= 'Invalid file type [ '.$file.<br />';
}
}
if(!$cfg->allowOnlineAttachments()) {
$errors .= 'File [ '.$file rejected.<br />';
}
$totalsize = $totalsize + $file;
}
if($totalsize>$cfg->getMaxFileSize()) {
$errors .= 'File is too big ('.$totalsize.' bytes). Max '.$cfg->getMaxFileSize().' bytes allowed.<br />';
}
if(($ticket=Ticket:($_POST,$errors,SOURCE))){
$msg='Support ticket request created';
if($thisclient && $thisclient->isValid()) //Logged in...simply view the newly created ticket.
<USERMENTION username="header">@header</USERMENTION>('Location: tickets.php?id='.$ticket->getExtId());
//Thank the user and promise speedy resolution!
$inc='thankyou.inc.php';
}else{
$errors=$errors?$errors:'Unable to create a ticket. Please correct errors below and try again!';
}
endif;
//page
require(CLIENTINC_DIR.'header.inc.php');
require(CLIENTINC_DIR.$inc);
require(CLIENTINC_DIR.'footer.inc.php');
?>