Hi all,

I made a non-Propel form, with several file inputs in it. But, now it
doesn't save the files!

This is my form.class.php:

        public function configure(){

                $aHospitals = HospitalPeer::selectList();

                foreach($aHospitals as $oHospital){
                        $this->widgetSchema['hospital' . $oHospital->getId()] = 
new
sfWidgetFormInputFile();
                        $this->widgetSchema->setLabel('hospital' . 
$oHospital->getId(),
$oHospital->getName());

                        $this->validatorSchema['hospital' . 
$oHospital->getId()] = new
sfValidatorFile(
                                array(
                                        'path'       => 
sfConfig::get('sf_upload_dir') . '/schedules',
                                        'mime_types' => array('application/pdf')
                                ),
                                array(
                                        'required'   => 'Er is geen planning 
geselecteerd.',
                                        'mime_types' => 'De planning heeft een 
verkeerde bestandsextensie
(enkel PDF).',
                                        'max_size'   => 'De planning is te 
groot (maximaal %max_size%
bytes).'
                                )
                        );

                }

        }



As you can see, I create a file input widget for each object
(hospital). I also create a validator which has to store the file.

This is my actions.class.php:

                $oForm = new myScheduleForm();
                if($oRequest->isMethod('post')){

                        
$oForm->bind($oRequest->getParameter($oForm->getName()), $oRequest-
>getFiles($oForm->getName()));
                        if($oForm->isValid()){

                                foreach($aHospitals as $oHospital){
                                        $oSchedule = new Schedule();
                                        
$oSchedule->setHospitalId($oHospital->getId());
                                        
$oSchedule->setSchedule($oForm->getValue('hospital' . $oHospital-
>getId()));
                                        $oSchedule->save();
                                }

                                $this->redirect('@dashboard');

                        }

                }



Here I create a new object (database record) for each hospital.

Does anyone know why the files are not being uploaded?
--~--~---------~--~----~------------~-------~--~----~
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