Hey!
I've been spending hours and hours to find a way to upload a file in
an embedded form. But I couldn't find a solution yet. :-(
It seems to be a common bug and there is already a ticket (http://
trac.symfony-project.org/ticket/6662). But I don't use doctrine forms.
I tried everything, including the workaround on
http://stereointeractive.com/blog/2008/12/23/symfony-12-upload-a-file-inside-an-embedded-form.
Unfortunately with no success.
Please, do you guys have any suggestions for me?!
Here is my form:
class JobForm extends sfForm
{
public function JobForm()
{
...
$this->embedForm("step2", new JobForm_Step2());
...
}
}
class JobForm_Step2 extends sfForm
{
public function configure()
{
...
$this->setWidget("image", new sfWidgetFormInputFile());
# define validator for image
$configData = sfConfig::get("app_job_image");
$this->setValidator("image", new sfValidatorFile(array(
"required" => false,
"path" => sfConfig::get('sf_upload_dir') . $configData
['upload_dir'] ,
"mime_types" => array('image/jpeg', 'image/jpg'),
"max_size" => $configData['max_size'] * 1024
), array(
"mime_types" => "Es werden nur Bilder im JPEG-Dateiformat
unterstützt",
"max_size" => "Dein ausgewähltes Bild ist zu groß (maximal ".
$configData['max_size']." Kilobyte)"
)));
...
}
}
Here is my action:
...
$this->form->bind($request->getParameter($this->form->getName()),
$request->getFiles($this->form->getName()));
...
if(!$this->form['step2']['image']->hasError() && is_object($this->form
['step2']['image']->getValue()))
{
# upload
}
$this->form['step2']['image']->getValue() is always NULL. Furthermore
$request->getFiles($this->form->getName()) is empty. How can that be??
The $_FILES array is not empty, so the files has been correctly sent
to the server.
I could really need some help here! Thanks,
Julian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---