0

$_FILES is empty after the request is sent, the rest of the data is passed normally in the request, only the files are not sent.

here you can see that FormData receives all data on files

and in the request where the files array does not come, do not pay attention to the rest of the input, I just do not fill them in and check for now what is happening with the file.

   <div class="mb-3 col-3">
            <input class="form-control" type="file" multiple name="files[]">
   </div>
    let files = document.querySelector('input[name="files[]"]').files
    
    for (let i = 0; i < files.length; i++) {
            Data.append(files[i].name,files[i],files[i].name)
    }

    let Data = new BX.ajax.FormData()

    BX.ajax.runComponentAction('dev:SendForm', 'sendForm',{
            mode: 'class',
            method: 'POST',
            data: {data:data},
            }).then(data => {
           console.log(Data)
        }, (reason) => {
            console.log(Data)
            }).catch((error) => {
                console.log(Data)
        })
    })

Here are the request headers, maybe something is wrong with the content-type, but I could not figure out how to correctly change it to multiple / formdata

I tried to change the title to multiple/formdata, but there I had to manually generate a boundary and I didn’t engage in such nonsense

0 Answers0