Domanda

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();

}

Hi,

In above code i have tried two zipped files one with 9.3 mB data and one with 1.20 mb. However for the 1.20mb files the code runs the way it is supposed to but for the larger one it shows error as files not found. We are using our host as service so am not getting that from where can i get my post max size, and is that a reason that it getting the error. And also i guess the set_time_limit is the reason. because to upload a file more than a 9 mb it might take more than size limit time.

Can anyone please guess that where i am going wrong. Any help is deeply appreciated.

È stato utile?

Soluzione

Its likely not getting to the server because of the size

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

Altri suggerimenti

Use FileReader and slice the file in chunks, upload them one by one (with AJAX), and reassemble the file on the server.

Google for implementations / examples.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top