The form has an <input type="file"> . The form has the attribute enctype="multipart/form-data" and method="post" . The file is small (less than 1 MB). On the server in the received request, the $_FILES empty. What could be the problem? Previously, it worked fine.

  • First, open the network monitoring tool in the developer’s tools in the browser and see if the file is sent at all - andreymal
  • Input has no name attribute, the form submit is intercepted by js and it does what it wants, a typo somewhere. - Yegor Banin
  • @andreymal Is it displayed there? Or do I need to look at heirs like Content-Length ? - PECHAIR
  • @ YegorBanin name is there. I just did not specify it in the question. - PECHAIR
  • Found one oddity in the browser's devtools: Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 . This is despite the fact that enctype="multipart/form-data" indicated in the 200% enctype="multipart/form-data" . I do not understand how this happens, but the type changes when sending a hike. - PECHAIR

1 answer 1

It turns out that one of the fields on the form was enableAjaxValidation Ajax validation. Therefore, the requests went without files - only for the validation of the model. And only then the main file and the rest of the fields. But the main did not reach, because The ajax request was not processed separately. Now everything is ok!