开发者

PHP File upload fails with blank screen when size exceeds 742 KB

开发者 https://www.devze.com 2022-12-24 18:26 出处:网络
This is one of the most bizarre errors I\'ve come across. So I\'ve written a little file upload web app for my friend and it works fine for any file less than or equal to 742kB in size. Needless to sa

This is one of the most bizarre errors I've come across. So I've written a little file upload web app for my friend and it works fine for any file less than or equal to 742kB in size. Needless to say, I arrived at this precise number based on relentless testing.

Weird part is that if the file size is just a few KB more, for example 743 or 750, I get an error saying "MySQL has gone away". But if it is 1MB or more, then I just get a blank screen. And it happens in less th开发者_开发百科an 2 seconds after I hit the upload button. So it doesn't look like a time-out to me.

I checked out the PHP.ini file for post size and upload size, they are all set to 5 MB or more. And the timeout is set to 60 seconds.

The uploaded file sits in MySQL database in a field of datatype mediumblob. I tried changing that to longblob. But that didn't help either.

Any help?

Thanks for reading, Girish


Try increasing max_allowed_packet (defaults to 1 mb) as described in the documentation here.

This link may also be of interest.


What is the mysql error number you are getting from the query to upload?

PHP Ref: mysql_error


http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html

0

精彩评论

暂无评论...
验证码 换一张
取 消