symfony - Symfony2 invalid token with big files -
i'm having problem token , file field form.
the validation of form this:
public function getdefaultoptions(array $options) { $collectionconstraint = new collection(array( 'fields' => array( 'file' => new file( array( 'maxsize' => '2m', 'mimetypes' => array( 'application/pdf', 'application/x-pdf', 'image/png', 'image/jpg', 'image/jpeg', 'image/gif', ), ) ), ) )); return array( 'validation_constraint' => $collectionconstraint }
when upload invalid size file(~5mb) error hope:
the file large. allowed maximum size 2m bytes
but when upload big file(~30mb) error changes:
the csrf token invalid. please try resubmit form uploaded file large. please try upload smaller file
the problem error token. i've in form {{ form_rest(form) }} code. think error change because of this: how increase upload limit files on symfony 2 form?
i don't want increase upload limit. want token error doesn't show.
php (not symfony) rejects file if bigger configured values in:
post_max_size upload_max_filesize
because of csrf-error thrown.
if want avoid have increase upload limit. way. if add file-constraint should no risk.
Comments
Post a Comment