Sunday, 15 January 2012

php - No POST parameters when upload file -


I am creating an upload file form, but a very weird bug appears ... when I upload the file, Symphony does not see. Post Standards

My Form Class:

  Class UploadDocumentForm Extends {AbstractType {Public Function buildForm (FormBuilderInterface $ Builder, Array $ option) $ builder- & gt; Add ('name', 'text', array ('label' => gt; 'name')); $ Manufacturer- & gt; Add ('file', 'file', array ('label' = & gt; 'fichier')); } Public function getName () {return 'upload_document_form'; }}   

My templates:

  & lt; Form action = "{{path ('upload_file')}}" enctype = "multiparty / form data" method = "post" & gt; {{Form_widget (upload_file_form)}} & lt; Input type = "submit" value = "environment le earther" /> & Lt; / Form & gt;   

My Controller Action Method:

  Public Function uploadAction (request $ request) {$ form = $ this- & gt; CreateForm (new UploadDocumentForm (), new document ()); $ Form & gt; Tie ($ request); If ($ form-> isValid ()) {[...]} [...]}   

My request (debug with firebug): < Pre> upload_document_form [name] blablabla upload_document_form [file] ID3��½ ¿½TRCK��½3/12TIT2 [...] upload_document_form [_token] bb5f9925002dafbab [.. .]

My request in the Symphony debug toolbar:

Request Post Parameter

No Post Standards

If I do one:

  dead (var_dump ($ request-> get ($ form-> getName ())));   

$ request return null

I have configured php.ini of my /etc/php5/apache/php.ini:

upload_max_filesize = 100M

max_file_uploads = 28

So, naturally, my form is not valid. The most odd is that if I upload a small file (under ~ 4mo), the post data is here, and all the work is fine!

No comments:

Post a Comment