ZF2-336: Form files and enctype

Issue Type: Improvement Created: 2012-06-01T15:20:01.000+0000 Last Updated: 2012-10-08T20:16:36.000+0000 Status: Closed Fix version(s): Reporter: Michael Ben-Nes (mbn_18) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Form

  • form
  • w3c

Related issues: Attachments:


I think that when someone declare:

{Code} $this->add($factory->createElement(array( 'name' => 'resource_image_file', 'attributes' => array( 'label' => 'File:', 'type' => 'file', ), ))); {Code}



form> element should add automatically the enctype="multipart/form-data" which is needed for successfully upload

Currently I need to do that explicitly using:

<pre class="highlight">
$add_resource_form->setAttribute('enctype', 'multipart/form-data');

From W3C {quote} enctype = content-type [CI] This attribute specifies the content type used to submit the form to the server (when the value of method is "post"). The default value for this attribute is "application/x-www-form-urlencoded". The value "multipart/form-data" should be used in combination with the INPUT element, type="file". {quote}


Posted by Robert Boloc (robertboloc) on 2012-09-07T10:33:50.000+0000

added in this pull request:

Posted by Ralph Schindler (ralph) on 2012-10-08T20:16:36.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.