2

I've got the following form...

<form class="clearfix" action="/application_submit.php" method="post" enctype="multipart/form-data" name="applicationForm" id="applicationForm">

    <!-- 100 text/select/option inputs or so that I won't include here... -->

    <div class="line">
      <div class="unit size1of1">
        <label class="field_label" for="freeform_application_attachments">Attachments</label>
        <input type="file" name="file_attachments_1" value="" id="freeform_application_attachments0"  /><br/>
        <input type="file" name="file_attachments_2" value="" id="freeform_application_attachments1"  /><br/>
        <input type="file" name="file_attachments_3" value="" id="freeform_application_attachments2"  /><br/>
        <input type="file" name="file_attachments_4" value="" id="freeform_application_attachments3"  /><br/>
        <input type="file" name="file_attachments_5" value="" id="freeform_application_attachments4"  />
      </div>
    </div>
</form>

And my submit JS...

        $('form#applicationForm').validate({
          onkeyup: false,
          onfocusout: false,
          onclick: false,
          submitHandler: function(form) {
            form.submit();
          }
        });

And lastly, the content headers that are sent over the wire in my network tab (in this example I am only putting in 2 files):

------WebKitFormBoundaryT5oEIdNCfF7vnxWr
Content-Disposition: form-data; name="file_attachments_1"; filename="lemonone-715d1576013f3260da2afa15a3ce26f03bacac72.zip"
Content-Type: application/zip


------WebKitFormBoundaryT5oEIdNCfF7vnxWr
Content-Disposition: form-data; name="file_attachments_2"; filename="browser   marklet.psd"
Content-Type: image/vnd.adobe.photoshop


------WebKitFormBoundaryT5oEIdNCfF7vnxWr
Content-Disposition: form-data; name="file_attachments_3"; filename=""
Content-Type: application/octet-stream


------WebKitFormBoundaryT5oEIdNCfF7vnxWr
Content-Disposition: form-data; name="file_attachments_4"; filename=""
Content-Type: application/octet-stream


------WebKitFormBoundaryT5oEIdNCfF7vnxWr
Content-Disposition: form-data; name="file_attachments_5"; filename=""
Content-Type: application/octet-stream


------WebKitFormBoundaryT5oEIdNCfF7vnxWr--

But on my server, here is what I'm getting...

Output

Which is generated by this code...

echo "\$_FILES array:<br />";
var_dump($_FILES);

So I've got enctype="multipart/form-data", I've got my method="POST", all my file inputs have names, the HTTP POST in my network tab says that the request contains the files to be uploaded -- but still, the $_FILES array is empty on the server-side?

What's going on?

Community
  • 1
  • 1

2 Answers2

1

Here you can find a checklist for files upload with PHP: https://stackoverflow.com/a/3587158/1439906

Maybe you're missing something in php.ini, data is sent but PHP ignores it. In particular you should first check the following settings: file_uploads = On, post_max_size, and upload_max_file_size. Such settings can be changed also in .htaccess files: remember to check them also.

Community
  • 1
  • 1
0

open your php.ini file and look for file_uploads make sure it's ON, file_uploads = On

JC Sama
  • 2,214
  • 1
  • 13
  • 13