Answer the question
In order to leave comments, you need to log in
How to solve file upload problem in symfony 1.4?
Good afternoon. There was a need to unearth the old project on symfony1.4 and tweak something there. One of the tasks: to upload files in the admin panel for one module.
Editing the form... Here is the code:
class SlideForm extends BaseSlideForm
{
public function configure()
{
$this->embedI18n(sfConfig::get('app_cultures_array'));
foreach ( sfConfig::get('app_cultures_array') as $culture ) {
$this->widgetSchema[$culture]['image_small'] = new sfWidgetFormInputFileEditable(array(
'file_src' => sfConfig::get('app_slider_image_dir').$this->getObject()->getImageSmall($culture),
'is_image' => true,
'edit_mode' => !$this->isNew(),
'template' => sfConfig::get('app_files_image_template')
));
$this->validatorSchema[$culture]['image_small'] = new sfValidatorFile(array(
'required' => $this->isNew() || !$this->getObject()->getImageSmall($culture),
'path' => sfConfig::get('sf_web_dir').sfConfig::get('app_slider_image_dir'),
'mime_types' => 'web_images',
));
$this->validatorSchema['image_small'.'_delete'] = new sfValidatorPass();
}
}
}
Answer the question
In order to leave comments, you need to log in
Did die(sfConfig::get('sf_web_dir').sfConfig::get('app_slider_image_dir'));
is the path correct? I understand that the advice is simple, but somehow I lost it and spent half a day tormented with the problem.
Unfortunately, I can't help with the first symphony, I'm only working with the second one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question