양식의 파일을 내 응용 프로그램 폴더 (public/img/clientes /)에 업로드하고 싶습니다.
내 양식 파일 업로드 필드 :파일을 응용 프로그램 폴더에 업로드 - 젠드 프레임 워크 3
$this->add(array(
'name' => 'foto',
'attributes' => array(
'type' => 'file',
),
'options' => array(
'label' => 'Logo da empresa:',
),
));
컨트롤러 내 추가 조치 기능 : 나는 그 이유를 찾기 위해 솔기를 캔트
public function addAction()
{
$form = new ClienteForm();
if ($this->getRequest()->isPost()) {
$data = $this->params()->fromPost();
$form->setData($data);
if ($form->isValid()) {
$data = $form->getData();
$name = $data['foto'];
if(isset($name)){
if(!empty($name)){
$location = __DIR__."../../../public/img/clientes/";
if(!move_uploaded_file($name, $location)){
return $this->redirect()->toRoute('home');
}
}
}
$this->clienteManager->addNewCliente($data);
return $this->redirect()->toRoute('clientes');
}
}
return new ViewModel([
'form' => $form
]);
}
사람이 좀 도와 수 있다면하지
을 작업 여기 해결책은 매우 감사 할 것입니다.
잘 설명 된 답변에 감사드립니다. 그 지금 일하고있어. –
당신은 환영합니다! – unclexo