douguazhi5966 2012-04-03 11:02
浏览 34


I have made a php page that sends an email message with multiple attachments. The loop which i used to attach multiple attachments and to check the size of attachments is ,

foreach(array_keys($_FILES['attach']['name']) as $key) 
    $filesize = $_FILES['attach']['size'][$key];
    $extention = pathinfo ($_FILES['attach']['name'][$key] ,PATHINFO_EXTENSION
    $totalsize = $totalsize + $filesize;

if($totalsize > 10000000) //10mb10000000
{$err="<font color=#990000 size=1>File exceeded maximum allowed limit of 10
$source = $_FILES['attach']['tmp_name'][$key];
$filename = $_FILES['attach']['name'][$key];
$mail->AddAttachment($source, $filename);
}//end Foreach loop

But when i try to attach a large file i get this error from the phpmailer class.

  Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate
  7355049 bytes) in /var/www/dev01/maiarn/Email/class.phpmailer.php on line 1677

Any body who can guide me Please.

  • 写回答

2条回答 默认 最新

  • duanpai6581 2012-04-03 11:10

    You might want to increase the PHP memory limit. If you're working on your development machine, you could search for the php.ini file and modify the memory_limit (which often defaults to 16M). Change that to f.e. 128M and restart your webserver.

    If you want to see it change, you can use the following line to show the configuration currently in use:

    <?php phpinfo(); ?>
    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 C++对比不同编码下相同字符串
  • ¥15 pyqt5设计界面控件之间的空白想消除
  • ¥15 想请教大家关于机器学习的问题
  • ¥15 虚幻UE保存Actor位置失败
  • ¥15 多个.nii合并为.nii.gz格式
  • ¥50 现在需要统计2023年全年 “签收时间(qssj)” 到 “提交时间(tjsj)” 小于半小时的业务量,但是要排除掉周末的时间,同时还要排除中午休息的时间。
  • ¥50 opencv模板匹配为何图像差别大仍然匹配数值高?
  • ¥15 如何成功完成主菜单和分菜单的代码编程C++
  • ¥15 怎样采集或者其它途径拿到全国最新个体工商户数据
  • ¥20 我是一名大学生,想学习java是自学还是报培训班呢