0

Why can't I get the .zip as type and its size through an uploading form but only can get its name only?

Array
(
    [file] => Array
        (
            [name] => Array
                (
                    [0] => attachments_2011_05_20.zip
                )

            [type] => Array
                (
                    [0] => 
                )

            [tmp_name] => Array
                (
                    [0] => 
                )

            [error] => Array
                (
                    [0] => 1
                )

            [size] => Array
                (
                    [0] => 0
                )

        )

)

Something extra should I do to get the zip size and type?

Run
  • 54,938
  • 169
  • 450
  • 748
  • Additional to the answers below: the data provided in `$_FILES` also depends on what the client sends. [Better to check the file-type on the server, using PHP](http://stackoverflow.com/questions/457797/best-way-to-recognize-a-filetype-in-php). – feeela Aug 18 '11 at 16:40

2 Answers2

2

Your error code is 1, which means means "file is too large" - your upload_max_filesize setting is too low, so the upload is being aborted.

Marc B
  • 356,200
  • 43
  • 426
  • 500
  • Thanks. I have increased the size of `upload_max_filesize` and it works fine now. – Run Aug 18 '11 at 16:45
0

LIST OF ERROR CODES UPLOAD_ERR_OK

Value: 0; There is no error, the file uploaded with success. UPLOAD_ERR_INI_SIZE

Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini. UPLOAD_ERR_FORM_SIZE

Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form. UPLOAD_ERR_PARTIAL

Value: 3; The uploaded file was only partially uploaded. UPLOAD_ERR_NO_FILE

Value: 4; No file was uploaded. UPLOAD_ERR_NO_TMP_DIR

Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. UPLOAD_ERR_CANT_WRITE

Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0. UPLOAD_ERR_EXTENSION

Value: 8; A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help. Introduced in PHP 5.2.0. http://www.php.net/manual/en/features.file-upload.errors.php

Shahrokhian
  • 1,100
  • 13
  • 28