Form files and enctype #2489

Closed
zfbot opened this Issue Sep 28, 2012 · 5 comments

Projects

None yet

4 participants

@zfbot

Jira Information

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

Description

I think that when someone declare:

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

The

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
{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}

@zfbot

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

added in this pull request: #2313

@zfbot

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF2-336

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

@bakura10

It will be solved by #2439.

It can be closed :).

@cgmartin

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

@weierophinney
Zend Framework member

Closed with #2619.

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