Form files and enctype #2489

zfbot opened this Issue Sep 28, 2012 · 5 comments


None yet

4 participants


Jira Information

Original Issue: ZF2-336
Issue Type: Improvement
Reporter: Michael Ben-Nes
Created: 06/01/12
Assignee: weierophinney
Components: Zend\Form


I think that when someone declare:

'name' => 'resource_image_file',
'attributes' => array(
'label' => 'File:',
'type' => 'file',


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

Currently I need to do that explicitly using:

$add_resource_form->setAttribute('enctype', 'multipart/form-data');

From W3C
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".


(Originally posted by: robertboloc on 09/07/12)

added in this pull request: #2313


This issue was ported from the ZF2 Jira Issue Tracker at

Known GitHub users mentioned in the original message or comment:
@weierophinney, @robertboloc


It will be solved by #2439.

It can be closed :).


The fix in #2439 has been moved over into it's own PR and merged in #2619. So this can really be closed now. :)

Zend Framework member

Closed with #2619.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment