上传了个大文件,发现有错误。 Array ( [name] => gy.jpg [type] => [tmp_name] => [error] => 3 [size] => 0 ) error=>3,这个是重点。顺着google之,3表示UPLOAD_ERR_PARTIALUPLOAD_ERR_PARTIAL Value: 3; The uploaded file was only partially uploaded. 意思是只有部分上传,然后查看php bug,发现 https://bugs.php.net/bug.php?id=19556 这里面有个家伙说他解决了类似的问题 I have solved this problem, it appears to be caused by the installation of Gzip 1.3.26.1aI recompiled Apache without Gzip and when I now retry the error does not occur anymore. In effect the script is not executed at all which is probably the default behaviour. 是因为apache开启了gzip压缩页面的功能,你自己研查下。
; Maximum allowed size for uploaded files. upload_max_filesize = 20M ; Maximum number of files that can be uploaded via a single request max_file_uploads = 20
错误号为3表示只有部分上传,你不妨用#9的方法去尝试。I recompiled Apache without Gzip and when I now retry the error does not occur anymore. In effect the script is not executed at all which is probably the default behaviour.这段英文好好理解一下。他好像是说丢掉Gzip重新编译一下apache。自己琢磨琢磨。也不太懂。
偶然看到了这篇文章,不知道是否有用: I have just spent the last 3 hours trying to figure out why only ever 3rd file would upload (and then files would only randomly upload) and i continued to get UPLOAD_ERR_PARTIAL. It turns out UPLOAD_ERR_PARTIAL can be caused by the header Connection: Keep-Alive.If you are working on a web app that requires a lot of file uploading, make sure to use on your uploader script to set: header("Connection: close");This will force the connection to be closed, and for a new connection to be opened to upload the file, which allows the file to be properly uploaded. http://www.bizzeh.com/739/php-problem-with-upload_err_partial-file-upload-error-code-3
(
[name] => helv6.jpg
[type] =>
[tmp_name] =>
[error] => 3
[size] => 0
)或者这里测试:http://tuan.66ka.com/up3.php
服务器操作系统 Linux 内核版本: 2.6.18-194.el5 服务器解译引擎 Apache/2.2.3 (Red Hat) 目录是有写的权限的,该给的全给了,而且小于10k的是正常上传的
Array ( [name] => gy.jpg [type] => [tmp_name] => [error] => 3 [size] => 0 )
error=>3,这个是重点。顺着google之,3表示UPLOAD_ERR_PARTIALUPLOAD_ERR_PARTIAL Value: 3; The uploaded file was only partially uploaded.
意思是只有部分上传,然后查看php bug,发现
https://bugs.php.net/bug.php?id=19556
这里面有个家伙说他解决了类似的问题
I have solved this problem, it appears to be caused by the installation of Gzip 1.3.26.1aI recompiled Apache without Gzip and when I now retry the error does not occur anymore. In effect the script is not executed at all which is probably the default behaviour.
是因为apache开启了gzip压缩页面的功能,你自己研查下。
限制了大小,查看源码
upload_max_filesize = 20M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
post_max_size = 200M查找upload_max_filesize,默认为8M改为
upload_max_filesize = 200M
upload_max_filesize
post_max_size
当正常上传时会出现Array ( [MAX_FILE_SIZE] => 1024000000 [u] => 上传图片 );
当失败时只有Array ( [MAX_FILE_SIZE] => 1024000000) ,没有[u] => 上传图片;对 $_FILES['ic_file'] 进行数组打印分析:
当正常上传时会出现Array ( [name] => helv1.jpg [type] => image/pjpeg [tmp_name] => /opt/tomcat/webapps/66ka/tmpimg/phpoc1ASw [error] => 0 [size] => 14352 );
当失败时就会出现:Array ( [name] => helv3.jpg [type] => [tmp_name] => [error] => 3 [size] => 0 ),除了[name],其它的值是空的;目前原因不明!
I have just spent the last 3 hours trying to figure out why only ever 3rd file would upload (and then files would only randomly upload) and i continued to get UPLOAD_ERR_PARTIAL. It turns out UPLOAD_ERR_PARTIAL can be caused by the header Connection: Keep-Alive.If you are working on a web app that requires a lot of file uploading, make sure to use on your uploader script to set:
header("Connection: close");This will force the connection to be closed, and for a new connection to be opened to upload the file, which allows the file to be properly uploaded.
http://www.bizzeh.com/739/php-problem-with-upload_err_partial-file-upload-error-code-3