물론 그 말은 내가 뭔가 잘못하고 있다는 뜻입니다. 나는 이것과 비슷한 전에 질문을 올렸고 몇 가지 대답을 얻었다. 글쎄 그 대답을 기반으로 (나는 지금 CI 클래스를 사용하지 않았다) 나는 새로운 문제를 겪고있다. 어떤 도움을 주시면 감사하겠습니다.CI의 업로드 클래스가 작동하지 않습니까?
PHP
public function do_upload() {
$scopeId = $this->input->get('id');
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|pdf';
$config['max_size'] = '1000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if (! $this->upload->do_upload()) {
$error = array('error' => $this->upload->display_errors());
echo 'error'; <----- This is what is showing up
// uploading failed. $error will holds the errors.
} else {
$data = array('upload_data' => $this->upload->data());
// uploading successfull, now do your further actions
redirect(site_url('discovery/scopeDetails?scID='.$scopeId.''));
}
echo $error;
}
HTML 폼 나는 보통 직접 HTML을 사용하지만 http://codeigniter.com/user_guide/libraries/file_uploading.html이 할 얘기 정확하게 일을 시도 형태로
<div id="upload">
<?=form_open_multipart('discovery/do_upload');?>
<input name="userfile" size="40" type="file" />
<input type="submit" value="Upload" />
</div>
.
$ error에는 무엇이 포함되어 있습니까? 먼저 확인해 볼께. 그런 다음 업로드 디렉토리에 쓰기 권한이 있는지 확인하십시오. –
어떻게 그 두 번째 부분을합니까? –
업로드 설정 파일이 있습니까? 업로드 디렉토리를 지정하는 곳? 이렇게 : $ config [ 'upload_dir'] = '/ home/somesite/www/media/uploads /'; ftp 또는 repo에서 해당 디렉토리를 확인하고 chmod 777을 적용했는지 확인하십시오. –