How to set maximum attachment size in Squirrelmail

627 views Asked by At

I am using squirrelmail and I have a max size limit 5mb. When User tries to upload file larger than this limit Squirrelmail shows warning message successfully.

The problem is when user tries to upload file larger than "post_max_size"(php.ini) value, my php page just refreshes and Squirrelmail doesn't display any warning message. Is there any way to handle files larger than "post_max_size" value?

<div class="compose">
<table cellspacing="0" class="table1" id="attachment_table">
 <tr class="header">
  <td class="fieldName" style="width: 1%; white-space: nowrap;">
   <?php echo _("New attachment");?>:
  </td>
  <td class="fieldValue">
   <?php
    if($max_file_size != -1) {
        echo '<input type="hidden" name="MAX_FILE_SIZE" value="' . $max_file_size . '" />';
    }
   ?>
   <input type="file" name="attachfile" size="48" <?php if ($accesskey_compose_attach_browse != 'NONE') echo 'accesskey="' . $accesskey_compose_attach_browse . '" '; ?>/>
   &nbsp;
   <input type="submit" name="attach" <?php if ($accesskey_compose_attach != 'NONE') echo 'accesskey="' . $accesskey_compose_attach . '" '; ?>value="<?php echo _("Attach"); ?>" />
   &nbsp;
   <?php
    if($max_file_size != -1) {
       echo '(' . _("Max.") . ' ' . humanReadableSize($max_file_size) . ')';
    }
    if (!empty($plugin_output['add_attachment_notes'])) echo $plugin_output['add_attachment_notes'];
   ?>
  </td>
 </tr>
 <?php
    if (!empty($plugin_output['attachment_inputs'])) echo $plugin_output['attachment_inputs'];
    $attachment_count = 1;
    foreach ($attachments as $attach) {
        ?>
 <tr class="attachment">
  <td class="fieldName" style="width: 1%">
   <input type="checkbox" name="delete[]" id="delete<?php echo $attachment_count; ?>" accesskey="<?php echo ($attachment_count % 10); ?>" value="<?php echo $attach['Key']; ?>" />
  </td>
  <td class="fieldValue"><label for="delete<?php echo $attachment_count; ?>">
   <?php echo $attach['FileName']; ?> - <?php echo $attach['ContentType']; ?> (<?php echo humanReadableSize($attach['Size']); ?>)
  </label></td>
 </tr>
        <?php
        $attachment_count++;
    }
    
    if (count($attachments) > 0) {
        ?>
 <tr class="header">
  <td colspan="2">
   <input type="submit" name="do_delete" <?php if ($accesskey_compose_delete_attach != 'NONE') echo 'accesskey="' . $accesskey_compose_delete_attach . '" '; ?>value="<?php echo _("Delete Selected Attachments"); ?>" />
  </td>
 </tr>
        <?php
    }
 ?>
</table>
</div>

0

There are 0 answers