D
D
Dmitry Koldyaev2015-04-02 15:27:05
symfony
Dmitry Koldyaev, 2015-04-02 15:27:05

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();
    }

  }
}

Everything seems to be correct. Folders exist, the rights for them are correct.
Widgets stopped working in the admin panel...
But when you try to upload files to these fields, the files are not uploaded: there are no messages that the form fields are empty, but there are no files in the database or in the folders. What's the matter, I have no idea.
I even started to sin on nginx. Delivered apache - result similar.
I understand that I don’t really have anything to count on helping to support the dinosaur, but if suddenly. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WarGot, 2015-04-29
@WarGot

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 question

Ask a Question

731 491 924 answers to any question