symfony1 - symfony 1.4 process file after upload in form, doesn't sends data to DB, but it saves file in disk -
i have form sfwidgetforminputfile field. i'm uploading images, , after upload, processing file uploaded.
i know can use validated_file_class this. i'm overwritting save() method in custom class, , file gets correctly saved storing in database doesn't works, sends me null values filename field. missing something?
here relevant code:
class myform extends basemyform { public function configure() { $this->widgetschema['image'] = new sfwidgetforminputfile(); $this->validatorschema['image'] = new sfvalidatorfile(array( 'required' => true, 'path' => sfconfig('sf_upload_dir'), 'mime_types' => 'web_images', 'validated_file_class' => 'mycustomvalidatedfile' )); } } class mycustomvalidatedfile extends sfvalidatedfile { public function save($file = null, $filemode = 0666, $create = true, $dirmode = 0777) { parent::save($file, $filemode, $create, $dirmode); } }
ok, got it...
i missing return statement save() method... should return name of file saved without path prefix.
$fn = parent::save($file, $filemode, $create, $dirmode); //processing return $fn;
Comments
Post a Comment