댓글에 사진 올릴려고 짠 소스인데 안되네요? 뭐가 잘못된는지 좀 봐주세요
<?
$total = count($_FILES['photo_file']['name']);
// Loop through each file
for($i=0; $i<$total; $i++) {
//Get the temp file path
$tmpFilePath = $_FILES['photo_file']['tmp_name'][$i];
//Make sure we have a filepath
if ($tmpFilePath != ""){
//Setup our new file path
$newFilePath = "./uploadFiles/" . $_FILES['photo_file']['name'][$i];
//Upload the file into the temp dir
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
//Handle other code here
}
}
}
if ($_FILES["photo_file"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
$allowed = array('gif','png' ,'jpg');
$filename = $_FILES['photo_file']['name'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if(!in_array($ext,$allowed) ) {
$uploadOk = 0;
}
?>
<input multiple="multiple" id="wr_3" type="file" style="width: 30px; height :30px; float:right; padding: 0px 5px 0px 0px; position: absolute;right:0px;top:0px; opacity:0; filter: alpha(opacity=0);cursor: pointer;" name="bf_file[]" title="Find+" <?php echo $i+1 ?>/>
<img src="/board/mobile/skin/board/basic/img/12-1.gif" style="width: 30px; height :30px; float:right;" alt="찾아보기"/>
답변 1개 / 댓글 2개
파일을 업로드 처리하는 페이지에서
print_r($_FILES['photo_file']) 또는
print_r($_FILES) 해보세여
위 명령어에서 값들이 나오면 파일은 읽혔다고 보면됩니다.
파일이 올라오는 부분은 해당 위치에 파일 확인하면 되겠습니다.
권한등 체크하시구여
답변에 대한 댓글 2개
답변을 작성하려면 로그인이 필요합니다.
$newFilePath = G5_DATA_PATH.'/uploadFiles/'.substr($member['mb_id'],0,2).'/'.$member['mb_id'].'.gif';
이거 추가 햇고
print_r($_FILES['photo_file'])
이것도 추가했어요
그리고 /board/mobile/skin/board/basic/uploadFiles uploadfiles는 이렇게 폴더를 만들었고
/board/mobile/skin/board/basic basic 안에 list.skin.php/view.skin.php/view_comment.skin.php/write.skin.php 이렇게 들어있습니다
<?
$newFilePath = G5_DATA_PATH.'/uploadFiles/'.substr($member['mb_id'],0,2).'/'.$member['mb_id'].'.gif';
$total = count($_FILES['photo_file']['name']);
// Loop through each file
for($i=0; $i<$total; $i++) {
//Get the temp file path
$tmpFilePath = $_FILES['photo_file']['tmp_name'][$i];
//Make sure we have a filepath
if ($tmpFilePath != ""){
//Setup our new file path
$newFilePath = "/uploadFiles/" . $_FILES['photo_file']['name'][$i];
//Upload the file into the temp dir
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
//Handle other code here
}
}
}
if ($_FILES["photo_file"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
$allowed = array('gif','png' ,'jpg');
$filename = $_FILES['photo_file']['name'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if(!in_array($ext,$allowed) ) {
$uploadOk = 0;
}
print_r($_FILES['photo_file'])
?>