我在表单中设置了最大上传文件大小:

$file = new Zend_Form_Element_File('file');
$file->setLabel('File to upload:')
    ->setRequired(true)
    ->addValidator('NotEmpty')
    ->addValidator('Count', false, 1)
    ->addValidator('Size', false, 10485760) //10MB = 10,485,760 bytes
    ->setMaxFileSize(10485760)
    ->setDestination(APPLICATION_UPLOADS_DIR);
$this->addElement($file);

但是我在Zend Framework应用程序中收到此错误消息:
Notice: Your 'upload_max_filesize' config setting limits the maximum filesize to '2097152'. You tried to set '10485760' in /location/to/Zend/Form/Element/File.php on line 620

我究竟做错了什么?

最佳答案

upload_max_filesize 是PHP本身配置中的一个选项,并且独立于Zend Framework。

如果您需要修改最大上传大小,则应在php.ini文件中进行设置-注意,您当然也必须修改 post_max_size

关于php - PHP,Zend框架: How to set the upload max filesize?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1883565/

10-12 01:28
查看更多