2016-12-06 1 views
2

새로운 호스팅에서 이전 cakePHP 응용 프로그램을 설정하려고하는데 갑자기 공유되는 godaddy 호스팅에서이 오류가 발생합니다. 그것은 오래된 호스팅에서 잘 작동합니다. 2 년 전 CakePHP에서 일했으며 왜 이것이 오는지 이해하지 못합니다. 내가 플러그인 다음 업로드를 사용하고하는 것은 cakephp-uploadCakePHP 업로드 플러그인 - 'photo_dir'필드에 기본값이 없습니다.

Error: SQLSTATE[HY000]: General error: 1364 Field 'photo_dir' doesn't have a default value 
SQL Query: INSERT INTO `prayag_cms`.`galleries` (`branch_id`, `name`, `album_id`, `display_photo`, `modified`, `created`) VALUES (0, 'Photo', 1, 'CpLMQ28WYAEOnow.jpg_large.jpg', '2016-12-06 10:17:14', '2016-12-06 10:17:14') 

이 내 confirguration

public $actsAs = array(
      'Containable', 
    'Upload.Upload' => array(
     'display_photo' => array(
      'fields' => array(
       'dir' => 'photo_dir' 
      ), 
          'thumbnailSizes' => array(
       'small' => '250x250', 
      ), 
          'thumbnailMethod' => 'php', 
          'path' => '{ROOT}webroot{DS}img{DS}{model}{DS}', 
     ), 

    ) 
); 

컨트롤러이다 : 그것은 [(웹 루트/IMG/사용자가 존재하지 폴더에 대해 발생 될 수있어

public function admin_add() { 
    if ($this->request->is('post')) { 
     $this->Gallery->create(); 
     if ($this->Gallery->save($this->request->data)) { 
      $this->Session->setFlash(__('The gallery has been saved.'), 'admin/flash_success'); 
      return $this->redirect(array('action' => 'index')); 
     } else { 
      $this->Session->setFlash(__('The gallery could not be saved. Please, try again.'), 'admin/flash_error'); 
     } 
    } 
    $branches = $this->Gallery->Branch->find('list'); 
    $albums = $this->Gallery->Album->find('list'); 
    $this->set(compact('branches', 'albums')); 
} 

답변

1

모델]) 또는 새 폴더 또는 액세스 폴더를 만들 수있는 권한이 없습니다. 이러한 이유로 사진에 대한

  1. 업로드되지
  2. 사진은 NULL
  3. 할당 photo_dir 업로드되지 않고 데이터베이스 필드는
  4. 그런 다음 당신이 그 오류를 얻을 NULL 값을 허용하지 않는 경우

당신의 문제가 해결되기를 희망합니다.

+0

나는'777'을 주었지만 아직 폴더를 만들지 않았습니다. 어떤 생각? –

+0

img 폴더에 대해 재귀 적으로 777 권한을 부여해야 할 수도 있습니다. 이제 필수 (webroot/img/users [model]) 폴더를 만들고 목적을 확인할 수있는 권한을 부여 할 수 있습니다 – tarikul05