Hi,

I am trying to implement file size validation for an upload field on a
form.

For security / performance the php.ini post_max_size config setting is
set to 8 mb.

Now I want to limit the file size upload to about 1 mb. I am using the
built in sfValidatorFile:

$this->setValidator("file", new sfValidatorFile(array('max_size' =>
1000000, 'mime_types' => array('text/plain'),'required'=>false)));

This works ok if the user uploads a 2 mb file, but if the
post_max_size is exceeded by the user trying to upload a file of say
10mb, a 500 error page is produced! This is not very friendly and it
makes it look like the page is broken, when actually it is a simple
validation error.

A way to request the browser to limit the file size would be
acceptable, and the 500 page would be reserved for bad requests....
But sadly after a quick google it doesn't look like that is possible.

How should this problem be dealt with?

Thanks
-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.


Reply via email to