0

当我尝试将图像保存到目录时,它不会保存到我的文件夹中。有人可以给我一些指示吗?

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

}
4

1 回答 1

1
$this->form->getValue('photo')->save(sfConfig::get('sf_upload_web_dir'));

也许你需要检查这个值sfConfig::get('sf_upload_web_dir')。目录存在,有写权限。通过 . 检查 post 值var_dump($_POST['photo']);

于 2012-06-07T07:35:38.747 回答