php 이미지 업로드 용량제한
글쓴이: pcs4820 / 작성시간: 금, 2012/07/13 - 12:42오전
php 로 이미지업로드시 용량을 제한하도록하려는데 잘안되네요.. 조언 부탁드리겠습니다...
--pic_upload.php--
<?php
//..mysql 부분만 생략...
if($upfile_name)
{
$checker = 0;
$ext = substr(strrchr($upfile_name,"."),1);
$ext = strtolower($ext);
echo $ext."</br>";
if (!($ext != "jpg"||$ext != "png"||$ext != "jpeg"||$ext != "gif"))
{
echo "해당 파일은 이미지가 아닙니다.</br>The file is not an image.";
$checker= 1;
}
if ($_FILES[$upfile_name]["size"] > 5242880)
{
echo "해당 파일은 5MB를 초과합니다.</br>The file exceed 5mb";
$checker= 1;
}
echo $original_name;
if($checker==0){
$original_name=$upfile_name;
$upfile_name=date('YmdHis')."_".$upfile_name;
$image = "/home/Sonogong/public_html/imgallery/Images/".$upfile_name;
copy($upfile, $image);
unlink($upfile);
$qry = "insert into pic (num, title, file_name) values('','$title', '$upfile_name');";
$res = mysql_query($qry, $connect);
if($res)
{
?>
<table align=center> <?=$upfile_name?> 업로드 완료 </table>
<?
}
else
{
?>
<table align=center> 데이터 베이스 에러 </table>
<?
}
}
else
{
?>
<table align=center> 이미지 업로드 실패 </table>
<?
}
}
echo "<meta http-equiv='Refresh' content='1; URL=gal.php'>";
?>-------------------------
저곳에서 어떻게 용량을 제한해야될지 모르겠네요
checker는 임시로만 저렇게 해둔거니 무시해주세요
Forums:


phpinfo하면
phpinfo()하면
post max size수정하시면 될겁니다^^
...
php.ini 에서 post max 하고 upload max 설정 하셔야 되구요, 저런식으로 체크하면 파일 업로드가 끝난다음 체크했던가 그랬던 기억이 나네요.
phpinfo가;;
제가 호스팅을 받아쓰는입장이라 그런건 수정할수없는거같네요, 다른방법 없을까요?
.htaccess
.htaccess 파일에 설정하는 방법도 있습니다.
http://php.net/manual/en/configuration.changes.php
댓글 달기