spoko zrzumiałem swój bład no ale mam mamły problem zrobiłem jeden formularz z dodawaniem fotek no i ok działą super przeszedłem do inego modułu i tam też wstawiam formularz do uploadu no i mam problem bo valid pokazuje mi że pole do uploadu przesyła warotść pustą;/ i formularz zwraca mi że pole plik jest puste może ktoś widzi mój błąd
public function executeOferta(sfWebRequest $request)
{
$this->form = new OfertaForm();
//sprawdzanie poprawnosci wysłania
if ($request->isMethod('post'))
{
$this->form->bind($request->getParameter('oferta'), $request->getFiles('oferta'));
if ($this->form->isValid())
{
$file = $this->form->getValue('file');
$filename = '1';
$extension = $file->getExtension($file->getOriginalExtension());
$file->save(sfConfig::get('app_upload_oferta_dir').'/'.$filename.$extension);
$this->redirect('oferta/addOferta?'.http_build_query($this->form->getValues()));
}
}
}
Formularz
<?php
class OfertaForm extends BaseForm
{
public function configure()
{
'tresc' => new sfWidgetFormTextarea(),
'file' => new sfWidgetFormInputFile(),
));
// $this->setDefaults(array('email' => 'Your Email Here', 'name' => 'Your Name Here'));
$this->widgetSchema->setNameFormat('oferta[%s]');
$this->setValidators(array( 'tresc' => new sfValidatorString
(array('min_length' => 4
), array('required' => 'The message field is required.')), 'file' => new sfValidatorFile(),
));
}
}