Post data is missing when posting the same data in

2019-08-06 02:37发布

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.

The post data looks like this:

["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"

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.

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?

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>

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

2条回答
冷血范
2楼-- · 2019-08-06 03:30

The code is seems to working okay for me. I think you should look for the problem on the other intermediary PHP files.

Could you include administrator/index.php source also? I want to see how you process the form. Is that var_dump($_REQUEST); on index.php?

查看更多
爷的心禁止访问
3楼-- · 2019-08-06 03:32

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

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.

查看更多
登录 后发表回答