php - POST data disapearing on large file upload - Stack Overflow

I'm having issues with a file uploading utility in my PHP application. When sending large files (9

I'm having issues with a file uploading utility in my PHP application. When sending large files (9MB+) over the form, I get a very odd behaviour: the POST data I've included in the form dissapears, including the file information.

I've already increased all PHP limits I could (time limit, max input time, post max size, memory limit and upload max filesize) and I still can't get the proper behaviour. I've tried replacing the regular HTTP forms with a Flash-based solution (SWFUpload, www.swfupload), still the same behaviour.

I've tried multiple files of similar sizes and its definitely not a particular file issue. I've debugged the POST vars sent using Firebug, and the correct variables are still there in the header, together with the file.

What could be going on here?

I'm having issues with a file uploading utility in my PHP application. When sending large files (9MB+) over the form, I get a very odd behaviour: the POST data I've included in the form dissapears, including the file information.

I've already increased all PHP limits I could (time limit, max input time, post max size, memory limit and upload max filesize) and I still can't get the proper behaviour. I've tried replacing the regular HTTP forms with a Flash-based solution (SWFUpload, www.swfupload), still the same behaviour.

I've tried multiple files of similar sizes and its definitely not a particular file issue. I've debugged the POST vars sent using Firebug, and the correct variables are still there in the header, together with the file.

What could be going on here?

Share Improve this question asked May 21, 2010 at 19:18 DfKimeraDfKimera 2,1462 gold badges21 silver badges40 bronze badges 3
  • 1 How about looking in the server logs. Try to spot any errors / warnings. – nc3b Commented May 21, 2010 at 19:22
  • I'm having the same issue. Did you solve your problem? – Pherrymason Commented Dec 29, 2010 at 10:56
  • server logs should give you an idea. Also look at the php error log, if available. – Salman Arshad Commented Dec 29, 2010 at 11:15
Add a ment  | 

4 Answers 4

Reset to default 2

Web servers can also be configured to limit request sizes. If you're using Apache, check out the LimitRequestBody directive.

Ok, I think I have the solution. You must check for both post_max_size directive and $_SERVER['CONTENT_LENGTH'], so if $_SERVER['CONTENT_LENGTH'] surpasses post_max_size means that they are trying to upload too many data.

$POST_MAX_SIZE = ini_get('post_max_size');
$mul = substr($POST_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
if( $_SERVER['CONTENT_LENGTH'] > $mul*(int)$POST_MAX_SIZE && $POST_MAX_SIZE )
{
    $error = true;
}

Solution taken from here: http://www.php/manual/en/features.file-upload.php#73762

try uploading small files of 1 - 2 MB .if you still not able to post the code .

hope you have added enctype='/multipart/form-data' in form definition .

What server are you running on? I think some servers OS have a limit set of how large files they allow. This value can be changed.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744654816a4586117.html

相关推荐

  • php - POST data disapearing on large file upload - Stack Overflow

    I'm having issues with a file uploading utility in my PHP application. When sending large files (9

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>