2013-10-15 4 views
0
function zip() 
{ 



    $zip = new ZipArchive; 



    $res = $zip->open($_FILES['file']['tmp_name']); 
    if ($res) { 




     for($i = 0; $i <= 2; $i++){ 
      $stat = $zip->statIndex($i); 

       $legitImage=explode('.',$stat['name']); 
       print_r($legitImage); 
       echo $legitImage[1]; 
       echo $legitImage[0]; 
       if($legitImage[1]=='png' && $legitImage[0] == 'Isometric_'.$i) 
       { 
        echo "It's an image"; 
        //do your operations 

       } 


      } 

     echo 'Not Valid Form,'.$zip->numFiles; 



    } 
    $zip->close(); 

} 

안녕,ajax를 사용하여 대용량 파일을 업로드하는 방법은 무엇입니까? 위의 코드에서

내가 두 개의 압축 파일 9.3 MB의 데이터를 하나 1.20 메가 하나를 시도했다. 그러나 1.20mb 파일의 경우 코드는 예상대로 실행되지만 큰 코드의 경우 파일을 찾을 수 없으므로 오류가 표시됩니다. 우리는 우리의 호스트를 서비스로 사용하고 있기 때문에 나의 최대 크기를 얻을 수있는 곳에서 정보를 얻지 못하고 오류가 발생하는 이유가 있습니다. 또한 set_time_limit이 이유라고 생각합니다. 9 메가 바이트 이상의 파일을 업로드하기 때문에 크기 제한 시간 이상 걸릴 수 있습니다.

아무도 내가 잘못 가고있는 것 같아요. 어떤 도움도 깊이 감사드립니다.

+0

확인을받지 – exussum

답변

0

그것의 가능성이 최대 업로드 php.ini 파일에 대한 크기 때문에 서버에

http://www.php.net/manual/en/features.file-upload.common-pitfalls.php

 The MAX_FILE_SIZE item cannot specify a file size greater than the file size that has been set in the upload_max_filesize in the php.ini file. The default is 2 megabytes. 

If a memory limit is enabled, a larger memory_limit may be needed. Make sure you set memory_limit large enough. 

If max_execution_time is set too small, script execution may be exceeded by the value. Make sure you set max_execution_time large enough 
0

FileReader을 사용하고 청크로 파일을 슬라이스하고 하나씩 (AJAX로) 업로드 한 다음 서버에서 파일을 재구성하십시오.

Google 구현/예.