views:

371

answers:

3

I'm setting the upload max filesize in my form:

$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);

But I'm getting this error message in my Zend Framework application:

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

What am I doing wrong?

A: 

Have you overwritten the default max size in php.ini?

Jay Zeng
+2  A: 

The upload_max_filesize is an option in the configuration of PHP itself, and independant of Zend Framework.

If you need to modify that max upload size, you should set it in your php.ini file -- note you'll certainly also have to modify post_max_size.

Pascal MARTIN
I'm trying to set these in my application.ini file as phpSettings.post_max_size but it doesn't seem to be working, is there another way I can set this? Like some sort of function? set_post_max_size() if such a function exists?
Andrew
Not sure this can be configured from the PHP code, actually, as dealing with the uploaded data/file is done by Apache+PHP before your script even really starts...
Pascal MARTIN
I believe you can configure from PHP code, ini_set('post_max_size', 10485760);
Jay Zeng
I wasn't able to get this to work: ini_set('post_max_size', 10485760);
Andrew
A: 

But How can change this without change php.ini config.

This can't do on application.ini

Sami