| 제목 | 선배님들 파일업로드좀 도와주세요..... | ||
|---|---|---|---|
| 글쓴이 | 초보프로그래머 | 작성시각 | 2015/07/12 14:24:10 |
|
|
|||
Array
(
[main_banner0] => Array
(
[name] => slide1.jpg
[type] => image/jpeg
[tmp_name] => C:\xampp\tmp\phpD2B2.tmp
[error] => 0
[size] => 253052
)
[main_banner1] => Array
(
[name] => slide2.jpg
[type] => image/jpeg
[tmp_name] => C:\xampp\tmp\phpD2C2.tmp
[error] => 0
[size] => 281078
)
[main_banner2] => Array
(
[name] => slide3.jpg
[type] => image/jpeg
[tmp_name] => C:\xampp\tmp\phpD2C3.tmp
[error] => 0
[size] => 197634
)
)
이렇게 파일폼을 전송합니다. main_banner0~2 (서버에서 print_r($_files) 의 값)컨트롤러는,
function main_b_update() {
print_r($_FILES); exit;
if(count($_FILES) == 3) {
$this->load->library('upload');
$this->upload->set_upload_path('../resource/upload/');
for($i = 0; $i < count($_FILES); $i++) {
$file_data = 'main_banner'.$i;
if (!$this->upload->do_upload($file_data)) {
script_alert_back('잘못 된 이미지 파일입니다.');
} else {
$data = array('upload_data' => $this->upload->data());
$result = $this->banner_m->main_b_update($data['upload_data']);
}
}
if($result) {
script_alert_location('수정이 완료 되었습니다.','/banner');
} else {
script_alert_back('수정에 실패 하였습니다.');
}
} else {
script_alert_back('배너 이미지를 첨부해주세요.');
}
}
하는데 계속 잘못 된 이미지 파일 입니다 라고 나오네요 ㅠㅠ |
|||
| 다음글 | 오라클 컬럼명 대문자 사용하는 이유를 알고 싶습니다. (1) | ||
| 이전글 | 크롬 오류문의드립니다. 혹시 이런 오류 보셨나요? (3) | ||
|
방문넷
/
2015/07/12 21:27:59 /
추천
0
|
|
변종원(웅파)
/
2015/07/13 11:58:24 /
추천
0
잘못된 이미지 경고창 대신에 $this->upload->display_errors() 출력해보세요.
어떤 에러가 났는지 알 수 있습니다. |
|
초보프로그래머
/
2015/07/14 10:45:26 /
추천
0
감사합니다. 확인해보겠습니다.
|
allow_type을 작성해보시고 PHp 업로드 사이즈도 한번 체크 해보시구요 그래도 안된다면
업로드 디렉토리의 퍼미션...을 한번 점검 해보시는게 좋을꺼같습니다.
전 메뉴얼대로 $config['업로드 각종옵션'] 을 설정후에
$this->upload->initialize($config);
로 해서 업로드를 사용중입니다(업로드엔 쫌 제가 쥐약이라 많은 정보를 드리기 힘드네요;;)