Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected function processForm(sfWebRequest $request, sfForm $form)
- {
- $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
- if ($form->isValid())
- {
- $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
- $icoana_model = $form->save();
- $full = new sfThumbnail(600, 570);
- $full->loadFile($form->getValue('path')->getTempName());
- $full->save(sfConfig::get('sf_upload_dir').'/full'.$icoana_model->path);
- $small = new sfThumbnail(190, 190);
- $small->loadFile($form->getValue('path')->getTempName());
- $small->save(sfConfig::get('sf_upload_dir').'/small'.$icoana_model->path);
- unlink(sfConfig::get('sf_upload_dir').'/'.$icoana_model->path);
- $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $icoana_model)));
- if ($request->hasParameter('_save_and_add'))
- {
- $this->getUser()->setFlash('notice', $notice.' You can add another one below.');
- $this->redirect('@icoana_model_icoana_new');
- }
- else
- {
- $this->getUser()->setFlash('notice', $notice);
- $this->redirect(array('sf_route' => 'icoana_model_icoana_edit', 'sf_subject' => $icoana_model));
- }
- }
- else
- {
- $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
- }
- }
Add Comment
Please, Sign In to add comment