简体   繁体   English

PHP文件上传无法使用超过65KB

[英]PHP file uploading doesn't work over 65KB

I have a VB.NET software that uploads files using an HTTP request to PHP. 我有一个VB.NET软件,它使用HTTP请求将文件上传到PHP。 This worked fine until May but now it fails when uploading files over 65KB. 直到五月份,它都可以正常工作,但是现在上传超过65KB的文件时失败。 I can not tell when it stops to work exactly. 我不知道什么时候该停止工作了。 Even though, I don't think it is relevant. 即使如此,我也不认为这是相关的。 So to be clear, uploading a file under 65KB works correctly. 很清楚,上传65KB以下的文件可以正常工作。

I looked with my hoster and he doesn't see any error neither do I on the server (the part I have access). 我看了看托管人,他没有看到任何错误,我在服务器上也没看到(我可以访问的部分)。 VB.NET doesn't give me a pertinent error, but using WireShark, I've been able to get either a 500 or a 400 error. VB.NET没有给我一个相关的错误,但是使用WireShark,我能够得到500或400错误。 But it didn't give me clues on what is failing. 但这并没有给我提供有关失败原因的线索。

I verified this question which is not solved, though the things said there are OK on the server too. 我验证了这个问题没有解决,尽管事情说服务器上也可以。 PHP not uploading file over 55 kb PHP未上传超过55 kb的文件

I have another option to fix it: splitting my files in chunks of 50KB and rejoining them via PHP. 我还有另一种解决方法:将文件分成50KB的块,然后通过PHP重新加入。 Though, I rather understand what is happening because this can happen again even with chunks of 50KB. 不过,我宁愿了解正在发生的情况,因为即使使用50KB的块也可能再次发生。

Server is Apache/2.4.28 (Unix) 服务器是Apache / 2.4.28(Unix)

EDIT 1 I have new conditions: I now have my own server running on Windows + Apache 2.4 + PHP 5.6. 编辑1我有新条件:我现在在Windows + Apache 2.4 + PHP 5.6上运行自己的服务器。

Now it goes a little farther. 现在,它走得更远了。 I have an error when using move_uploaded_file function that gives me: Error #3: The uploaded file was only partially uploaded. 使用move_uploaded_file函数时出现错误:错误#3:上传的文件仅部分上传。 It is coherent with the file being stopped to be sent near the end. 它与文件停止同步发送将近结束是一致的。 So I now receive an HTTP 200 response but a failure after ward even though I suspect not being there. 所以我现在收到HTTP 200响应,但是即使我怀疑不在那里,在病房之后还是失败了。

  • I can certify I did not stop my VB.NET software that is uploading the file. 我可以证明我没有停止正在上传文件的VB.NET软件。
  • I tested changing KeepAlive to Off/False on both sides. 我测试了在两侧将KeepAlive更改为Off / False。 No luck :( 没运气 :(
  • Tried to add header ("Connection: close"); 试图添加header ("Connection: close"); in my main file (that is used for all transactions with this VB.NET software). 在我的主文件中(该文件用于与此VB.NET软件进行的所有交易)。 No luck. 没运气。
  • Even though, it is not currently an issue, I changed (PHP configs) the upload_max_filesize to 256M and post_max_size to 300M (because it will be a problem if a can figure out this one). 即使当前不是问题,我还是将PHP_configs的upload_max_filesize更改为256M,将post_max_size更改为300M(因为如果可以弄清楚这将是一个问题)。

I got those suggestions from : https://wordpress.stackexchange.com/questions/176465/failed-media-upload-the-uploaded-file-was-only-partially-uploaded 我从以下网站得到了这些建议: https : //wordpress.stackexchange.com/questions/176465/failed-media-upload-the-uploaded-file-was-only-partially-uploaded

The only one I could not try is replacing an apache/php module which doesn't seem to exist on Windows. 我唯一无法尝试的就是替换Windows上似乎不存在的apache / php模块。

Depending on your server's configuration, when an error 500 is returned an error_log is written. 根据服务器的配置,当返回错误500时,将写入error_log The problem is with the error 400. Which according to wikipedia's list of HTTP codes is actually a BAD REQUEST . 问题出在错误400。根据Wikipedia的HTTP代码列表,该错误实际上是BAD REQUEST Some output from your error_log when the attempt is being made might put us in the right direction. 尝试进行操作时,来自error_log的一些输出可能会将我们引向正确的方向。

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

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