2010-04-10 4 views
0

class.upload.php을 사용하여 사진을 서버에 업로드하고 있습니다.

Array 
(
    [image_file] => somefile.png 
    [add_new] => Add image 
) 
Array 
(
) 

당신이 두 번째 배열을 볼 수 있듯이이 비어 ($ _FILES : 여기

if(array_key_exists('add_new', $_POST)) 
{ 
    echo 'add new is in array'; 

    echo '<pre>'; 
    print_r($_POST); 
    print_r($_FILES); 
    echo '</pre>'; 

    $handle = new Upload($_FILES['image_file']); 
    ... 
} 

가에서 print_r의 출력은 다음과 같습니다 PHP 코드에서

<form action="<?="http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];?>" method="post" enctype="multipart/form-data"> 
    <table style="width: 100%; padding-top: 20px;"> 
    <tr> 
     <td>Image file:</td> 
     <td><input type="file" name="image_file" /></td> 
    </tr> 
    <tr> 
     <td>&nbsp;</td> 
     <td align="right"><input type="submit" name="add_new" value="Add image" /><td></td> 
    </tr> 
</table> 
</form> 

내가 할 : 여기 내 양식입니다), 그래서 이미지는 업로드되지 않습니다. 왜?


  • 운영 체제 : 리눅스
  • PHP 버전 : 5.2.12
  • GD 버전 : 2.0.34
  • 지원되는 이미지 형식 : PNG JPG GIF, BMP
  • 의 open_basedir :/홈/httpd/vhosts/% site %/httpdocs :/tmp
+0

이상한 http://php.net/manual/en/features.file-upload.php에서. 어떤 PHP 버전입니까? –

+0

@Pekka, 방금 방글라데시를 업데이트했습니다. – Ockonal

+0

파일이 업로드되고 있습니까? 큰 파일의 로딩 시간에서 볼 수 있습니까? –

답변

1

post_ma보다 작은 이미지를 사용해 보셨나요? x_size ini 설정? 또한/tmp에 공백이 있고 쓰기가 가능한지 확인하십시오.

기타 리소스 :

1) 여기 원인의 긴 목록 : http://getluky.net/2004/10/04/apachephp-_files-array-mysteriously-empty/

2)

As said before if POST size exceeds server limit then $_POST and $_FILES arrays become empty. You can track this using $_SERVER['CONTENT_LENGTH']. 
For example: 

<?php 
$POST_MAX_SIZE = ini_get('post_max_size'); 
$mul = substr($POST_MAX_SIZE, -1); 
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); 
if ($_SERVER['CONTENT_LENGTH'] > $mul*(int)$POST_MAX_SIZE && $POST_MAX_SIZE) $error = true; 
?> 
+0

그 목록을보고 모든 것을 확인했습니다. 한도는 15M입니다. 120 킬로바이트를 올리겠습니다. – Ockonal

+0

및/tmp status (또는 임시 파일이 저장되는 모든 위치)? – zaf

+0

모든 것이 정상입니다. – Ockonal

관련 문제