Hi,

This project was working fine but after update it now unable to upload
files and coming up with this form errors:

Unexpected extra form field named "name". Unexpected extra form field
named "type". Unexpected extra form field named "tmp_name". Unexpected
extra form field named "error". Unexpected extra form field named
"size".

It seems like it is reading the file info array as form fields?

Action:
=====

  public function executeUpload(sfWebRequest $request)
  {
    $user = $this->getUser();
    /* @var $user myUser */

    $form = new PhotoMergeUploadForm();
    $this->form = $form;

    if ($request->isMethod('post'))
    {
      $form->bind($request->getParameter('upload'), $_FILES['upload']);

      if ($form->isValid())
      {
        $form->storePhotos($user);

        return sfView::SUCCESS;
      }
    }

    return 'Form';
  }


Form:
=====

  public function setup()
  {
    $existing_html = '<p>You have already uploaded a file.' .
                     'Use the browse button if you wish to replace it ' .
                     'with a different one.</p>';

    $this->setWidgets(
      array(
        'photo1' => new
pkWidgetFormInputFilePersistent(array('existing-html' =>
$existing_html)),
        'photo2' => new
pkWidgetFormInputFilePersistent(array('existing-html' =>
$existing_html)),
        'photo3' => new
pkWidgetFormInputFilePersistent(array('existing-html' =>
$existing_html)),
        'photo4' => new
pkWidgetFormInputFilePersistent(array('existing-html' =>
$existing_html)),
      )
    );

    $this->setValidators(
      array(
        'photo1' => new pkValidatorFilePersistent(array('required' => true)),
        'photo2' => new pkValidatorFilePersistent(array('required' => true)),
        'photo3' => new pkValidatorFilePersistent(array('required' => false)),
        'photo4' => new pkValidatorFilePersistent(array('required' => false)),
      )
    );

    $this->widgetSchema->setLabels(
      array(
        'photo1' => 'Photo 1: <em>*</em>',
        'photo2' => 'Photo 2: <em>*</em>',
        'photo3' => 'Photo 3:',
        'photo4' => 'Photo 4:',
      )
    );

    $this->widgetSchema->setNameFormat('upload[%s]');

    $decorator = new myWidgetFormSchemaFormatterCustom($this->widgetSchema);
    $this->widgetSchema->addFormFormatter('custom', $decorator);
    $this->widgetSchema->setFormFormatterName('custom');
  }


Anyway, I'm reverting back to stable.

-- 
Blue Horn Ltd - System Development
http://bluehorn.co.nz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to