Copy
$SAVE_DIR = "/home1/**/**/uploads/mon_4/"; foreach ($_FILES["b"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $allow_ext = array('jpg','jpeg','png','gif','JPG','JPEG','PNG','GIF'); $fname = explode(".", $_FILES['b']['name'][$key]); $ext = strtolower($fname[count($fname)-1]); if(!in_array($ext, $allow_ext)) { echo "<script> alert('업로드할수 없는 파일입니다.'); </script>"; exit; } $tmp_name = $_FILES["b"]["tmp_name"][$key]; $_FILES["b"]["name"][$key] = time().$key.".".$ext; $name = time()."_".$_FILES["b"]["name"][$key]; $savefile = $SAVE_DIR.$name; move_uploaded_file($tmp_name, $savefile); }//if end }//foreach end for($i=0;$i<count($week);$i++) { $name = time()."_".$_FILES["b"]["name"][$i]; $sql = "insert into test set week = '{$week[$i]}', a = '{$a[$i]}', b = 'http://**.co.kr/**/uploads/mon_4/{$name}', c = '{$a[$i]}'"; sql_query($sql) or die (sql_error()); }
코드는 이렇게 작성하였습니다.
DB에 저장은 잘되는데, 디렉토리에 파일이 저장이 안됩니다..ㅜㅜ
uploads/mon_4/ << 두 폴더 모두 파일 권한 707 을 부여했어요.
답변 1개
8년 전
move_uploaded_file
이것 사용해서 업로드가 되지 않을 때가 있어요
아무래도 서버 설정 문제인듯한데요
이럴 때는
system('cp -rf 원본파일 복사될파일(경로포함)');
이렇게 해보세요.
답변을 작성하려면 로그인이 필요합니다.