简体   繁体   English

php上传:zip文件

[英]php upload: zip files

Why can't I get the .zip as type and its size through an uploading form but only can get its name only? 为什么我不能通过上传表单获取.zip作为类型和大小,但只能得到它的名字?

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? 我应该做些什么来获得拉链尺寸和类型?

您的错误代码1 ,这意味着“文件太大” - 您的upload_max_filesize设置太低,因此上传正在中止。

LIST OF ERROR CODES UPLOAD_ERR_OK 错误代码列表UPLOAD_ERR_OK

Value: 0; 值:0; There is no error, the file uploaded with success. 没有错误,文件上传成功。 UPLOAD_ERR_INI_SIZE UPLOAD_ERR_INI_SIZE

Value: 1; 价值:1; The uploaded file exceeds the upload_max_filesize directive in php.ini. 上传的文件超过了php.ini中的upload_max_filesize指令。 UPLOAD_ERR_FORM_SIZE UPLOAD_ERR_FORM_SIZE

Value: 2; 价值:2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form. 上载的文件超出了HTML表单中指定的MAX_FILE_SIZE指令。 UPLOAD_ERR_PARTIAL UPLOAD_ERR_PARTIAL

Value: 3; 价值:3; The uploaded file was only partially uploaded. 上传的文件仅部分上传。 UPLOAD_ERR_NO_FILE UPLOAD_ERR_NO_FILE

Value: 4; 价值:4; No file was uploaded. 没有上传文件。 UPLOAD_ERR_NO_TMP_DIR UPLOAD_ERR_NO_TMP_DIR

Value: 6; 价值:6; Missing a temporary folder. 缺少临时文件夹。 Introduced in PHP 4.3.10 and PHP 5.0.3. 在PHP 4.3.10和PHP 5.0.3中引入。 UPLOAD_ERR_CANT_WRITE UPLOAD_ERR_CANT_WRITE

Value: 7; 价值:7; Failed to write file to disk. 无法将文件写入磁盘。 Introduced in PHP 5.1.0. 在PHP 5.1.0中引入。 UPLOAD_ERR_EXTENSION UPLOAD_ERR_EXTENSION

Value: 8; 价值:8; A PHP extension stopped the file upload. PHP扩展程序停止了文件上载。 PHP does not provide a way to ascertain which extension caused the file upload to stop; PHP没有提供确定哪个扩展名导致文件上传停止的方法; examining the list of loaded extensions with phpinfo() may help. 使用phpinfo()检查加载的扩展名列表可能有所帮助。 Introduced in PHP 5.2.0. 在PHP 5.2.0中引入。 http://www.php.net/manual/en/features.file-upload.errors.php http://www.php.net/manual/en/features.file-upload.errors.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM