快速顺序发布相同数据时缺少发布数据 [英] Post data is missing when posting the same data in rapid sequence

查看:83
本文介绍了快速顺序发布相同数据时缺少发布数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个表单,其中包含一些字段(名称,标题等),其中包括将图片字段存储在我的mysql数据库中的图像上传.

I made a form with a few fields (name, title, etc) including an image upload thats stores the fields in my mysql database.

当我第一次提交表单时,我收到了我所有的帖子数据,并且能够使用该帖子数据来构建数据库查询.

When I submit the form for the first time I receive all my post data and am able to use the post data to build my database query.

帖子数据如下:

["option"]=>
  string(9) "com_jimmo"
  ["jform"]=>
  array(6) {
    ["id"]=>
    string(0) ""
    ["lang_code"]=>
    string(5) "nl-NL"
    ["title"]=>
    string(0) ""
    ["jimmo_id"]=>
    string(3) "141"
    ["path"]=>
    string(0) ""
    ["featured"]=>
    string(1) "0"
  }
  ["task"]=>
  string(11) "image.apply"
  ["controller"]=>
  string(5) "image"
  ["244dd7871d511949f4cf87df21403258"]=>
  string(1) "1"

当我再次张贴完全相同的表格时,正好在上一个表格之后.很多Post数据丢失了,我只收到了它(jform ['featured']之后的所有post变量都丢失了):

When I post the exact same form again, imediatly after the previous one. A lot of Post data is missing and I only receive this (all the post variables after jform['featured'] are missing):

["option"]=>
  string(9) "com_jimmo"
  ["jform"]=>
  array(6) {
    ["id"]=>
    string(0) ""
    ["lang_code"]=>
    string(5) "nl-NL"
    ["title"]=>
    string(0) ""
    ["jimmo_id"]=>
    string(3) "141"
    ["path"]=>
    string(0) ""
    ["featured"]=>
    string(1) "0"
  }

如果我一遍又一遍地重新张贴同一表格,则数据仍然丢失.但是,当我等待一分钟然后再试一次时,所有的发布数据都恢复了.

If I keep reposting the same form over and over again that data stays missing. But when I wait for a minute and try again all the post data is back.

对我来说,这似乎是一个内存问题,但我无法查明.我要发布的图像只有700KB大,并且对于网络服务器上的以下php设置,其他变量和图像组合不应太大:

This seems like a memory problem to me but i'm unable to pinpoint it. The image i'm posting is only 700KB large and the the other variables and image combined should not be to large for the following php settings on the webserver:

  • max_execution_time 60
  • max_file_uploads 20
  • max_input_time 60
  • max_input_vars 1000
  • memory_limit 128MB
  • post_max_size 8MB
  • upload_max_filesize 8MB

有没有人知道按成功顺序发布时可能导致发布数据丢失的原因?

Does anyone have an idea to what might cause post data to be missing when posted in succesive order?

根据请求获取我的html:

as per request my html:

    <form action="/administrator/index.php?option=com_jimmo" method="post" name="adminForm" id="jimmo-form" enctype="multipart/form-data">
        <fieldset class="adminform">
        <legend>afbeeldingen</legend>
        <ul class="adminformlist">
            <li><input type="hidden" name="jform[id]" id="jform_id" value=""></li>
            <li><label id="jform_lang_code-lbl" for="jform_lang_code" class="">selecteer een taal</label><select id="jform_lang_code" name="jform[lang_code]">
    <option value="0">default</option>
    <option value="nl-NL" selected="selected">Dutch</option>
    <option value="en-GB">English (UK)</option>
</select>
</li>
            <li><label id="jform_title-lbl" for="jform_title" class="hasTip" title="">title</label><input type="text" name="jform[title]" id="jform_title" value="" class="inputbox" size="40"></li>
            <li><label id="jform_jimmo_id-lbl" for="jform_jimmo_id" class="">pand</label><select id="jform_jimmo_id" name="jform[jimmo_id]">
    <option value="125">Uitstekend gelegen app met twee slaapkamers </option>
    <option value="156">test webmamba 2</option>
</select>
</li>
            <li><label id="jform_path-lbl" for="jform_path" class="">afbeelding</label><select id="jform_path" name="jform[path]">
    <option value="-1">- Niets geselecteerd -</option>
    <option value="" selected="selected">- Gebruik standaard -</option>
    <option value="141_1346935067.jpg">141_1346935067.jpg</option>
    <option value="141_1347022237.jpg">141_1347022237.jpg</option>
</select>
</li>
            <li><label id="jform_featured-lbl" for="jform_featured" class="">toon afbeelding als voorvertoning</label><select id="jform_featured" name="jform[featured]">
    <option value="0" selected="selected">No</option>
    <option value="1">Yes</option>
</select>
</li>
            <li>
                <label id="jform_jimmo_image-lbl" for="jform_jimmo_image" class="">Upload new Image</label>
                <input type="file" name="jform_jimmo_image">
            </li>
            <li>
                <label id="jform_jimmo_preview-lbl" for="jform_jimmo_preview" class="">Current Image</label>
                <img name="jform_jimmo_preview" src="http://immo-outlook.be/images/jimmo/">
            </li>
        </ul>
    </fieldset>
    <div>
                <input type="hidden" name="task" value="image.edit">
        <input type="hidden" name="controller" value="image">
        <input type="hidden" name="a059e7116c95f234bdac9458883d7b93" value="1"> </div>
</form>

该操作的php代码仅为var_dump($_REQUEST);

The php code of the action is just var_dump($_REQUEST);

推荐答案

我已经找到解决问题的方法.我在文件上传中收到错误"3",这意味着仅部分上传了成功文件.

I've found the solution to my problem. I was receiving an error "3" in my file upload which means that the succesive files were only partially uploaded.

我已经搜索了可能导致这种情况发生的原因,并在此处找到了答案:

I've googled what might cause this to happen and found the answer here: http://www.bizzeh.com/739/php-problem-with-upload_err_partial-file-upload-error-code-3

我刚刚花了最后3个小时来弄清楚为什么只有 第三个文件将上传(然后文件将仅随机上传),并且 我继续得到UPLOAD_ERR_PARTIAL.原来是UPLOAD_ERR_PARTIAL 可能是由标题Connection:Keep-Alive引起的.如果你在工作 在需要上传大量文件的网络应用上,请确保使用 在您的上传脚本上设置:header("Connection:close");这将 强制关闭连接,并强制建立新连接 打开以上传文件,从而使文件正确无误 已上传.

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.

这篇关于快速顺序发布相同数据时缺少发布数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆