我正在我的表单中设置上传最大文件大小:
$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、Zend 框架 : How to set the upload max filesize?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1883565/