Reputation: 83
When I try to save images to a directory, it's not saving to my folder. Could anybody can give me some directions?
protected function processForm(sfWebRequest $request, sfForm $form)
{
$formPost=$request->getParameter('planbook');
if(!$planbook=Doctrine::getTable('Planbook')->find($formPost['id'])){
$planbook= new Planbook();
}
$planbook->fromArray($formPost);
$this->form->getObject()->getPhoto();
$planbook->save();
//$this->redirect('@planbook_view='.$planbook->getid());
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
//if ($form->isValid())
//{
$planbook = $form->save();
$this->form->getValue('photo')->save(sfConfig::get('sf_upload_web_dir'));
//$this->redirect('planbook/edit?id='.$planbook->getId());
//$request->getFiles($this->form->getName());
}
Upvotes: 0
Views: 143
Reputation: 764
$this->form->getValue('photo')->save(sfConfig::get('sf_upload_web_dir'));
Maybe you need to check this value sfConfig::get('sf_upload_web_dir')
.
Directory exists, have permissions to write. Check the post value by var_dump($_POST['photo']);
.
Upvotes: 1