| 제목 | 첨부 파일에 대해서 질문 있습니다. | ||
|---|---|---|---|
| 글쓴이 | 과학나라 | 작성시각 | 2013/10/01 14:40:57 |
|
|
|||
우선 소스를 보여드리자면
...생략....
document.wform.submit();
...생략....
<form name="wform" method="post" action="/cQuestion/writepost" enctype="multipart/form-data">
....생략....
<tr>
<td >내용</td>
<td >
<textarea name="memo" cols=60 rows=14 size="39"></textarea>
</td>
</tr>
<tr>
<td><input type="file" name="user_upload_file" style="width:500px" class="sbox"></td>
</tr>
type을 file로 주고 name을 user_upload_file로 주었습니다.그다음 컨트롤러에 writepost에 가는데요.
public function writepost()
{
$this->load->model('mcommon'); //모델 호출
$this->mcommon->write_entry(); //쓰기
// 사용자가 업로드 한 파일을 /static/user/ 디렉토리에 저장한다.
$config['upload_path'] = './static/user';
// git,jpg,png 파일만 업로드를 허용한다.
$config['allowed_types'] = 'gif|jpg|png';
// 허용되는 파일의 최대 사이즈
$config['max_size'] = '100';
// 이미지인 경우 허용되는 최대 폭
$config['max_width'] = '1024';
// 이미지인 경우 허용되는 최대 높이
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload("user_upload_file"))
{
echo $this->upload->display_errors();
}
else
{
$data = array('upload_data' => $this->upload->data());
echo "성공";
var_dump($data);
}
}
일단은 view에 뿌리지 않고 만약 파일의 조건이 안맞으면 display_errors()로 왜 조건이 안맞는지 뿌려질테고 만약 조건이 맞으면 var_dump($data);로해서 성공된 파일 내역이 나오게 구성했습니다. 일단 조건이 안맞아서 이유가 나오는데 "the upload destination folder does not appear to be writable" 업로드 대상 폴더 쓸 수 표시되지 않습니다. 이것이 무슨말인가요.. 폴더 지정도 제대로 하고. 서버에 연결 할수 없다는 뜻인가요? 폴더는 제대로 만들었습니다. ./static/user 왜 안되는것인지..ㅠ.ㅠ |
|||
| 다음글 | 레이아웃 질문잇습니대 (2) | ||
| 이전글 | 페이지 보안에 대해.. (5) | ||
|
빛그림
/
2013/10/01 14:50:23 /
추천
0
디렉토리에 퍼미션 부여하셨나요?
|
|
과학나라
/
2013/10/01 15:04:32 /
추천
0
아 이런 여기서 문제가 발생될줄 몰랐네요 감사합니다!!
|