dry0106 2013-01-22 19:06
浏览 48

如何在没有POST数据的情况下提交表单?

I'm running across an issue that neither myself nor a senior developer with the company for 7+ years can solve, so I'm hoping y'all can help. PHP is reporting that $_POST is empty after submitting a form. Though a majority of our users are on Windows XP with IE8, it's worth noting that this OS/Browser combination is the only one that is experiencing issues. Also, we have 125-150 uploads daily (mostly with IE8) and only 3-5 users experience an issue per week. One user I spoke to had successfully uploaded multiple documents in the past without issue and on the same computer, was unable to upload a document last week.

Has anyone else experienced problems with form submissions from IE8 not containing POST data?

Our company has an upload form loaded in a jQuery UI dialog for uploading multiple files, with a basic progress meter and a cancel button. The code is long and scattered in several files, which is why I'm choosing not to copy/paste it at this moment, but I'll do my best to illustrate in brief.

<div id="dialog_div">
<div id="form_container">
    <form>
    </form>
</div>
<div id="progress_div">
</div>
</div>

The form has five file inputs and a submit button that's initially disabled and only enabled when one or more files have been selected. The progress div is hidden and the form is shown, then on submit, the form is hidden and the progress div is displayed. Using a setTimeout(), the progress div is refreshed every two seconds to show percent uploaded as well as including a cancel button. We're using PHP's session upload progress to track the upload and check that it doesn't exceed a maximum size. If it does exceed the maximum size, the XHR is aborted on the client side. Clicking the cancel button runs the same JS function that is used to abort uploads of files that are too large. When the cancel button is clicked, the PHP script that receives the form is never executed, so nothing shows up in our error logs. The upload could also be aborted if our progress script doesn't find session data about the upload within 20 seconds.

The confusing part is that the PHP script that receives the form is generating an error in our logs that amounts to "No form received" because $_POST is empty. The files that users are having an issue with are NOT too large and our staff was able to do the uploads for them with the same files and through the same interface. When the cancel button is clicked, the script never executes, so we don't think it's a problem with the upload being aborted.

Ideas from the community?

  • 写回答

1条回答 默认 最新

  • douyoufan7881 2013-01-22 19:15
    关注

    We had a similar issue all of a sudden with about a 3% fail rate with file uploads. No issues with anyone else, just select clients.

    The issue was traced to bad internet connections and client-side time outs. So, what we did was replace everything with a custom plupload(http://www.plupload.com/) implementation. This way, the files are broken up into small chunks client-side and then uploaded and recombined on the server. This fixed the issue for us, and may be worth a try.

    评论

报告相同问题?

悬赏问题

  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 蓝桥oj3931,请问我错在哪里
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state