Multiple file upload fails but passing single file is working

I am trying to pass multiple pdf files to controller method.
This is my code in javascript:
js code

And this is in controller:
controller

I get this error
error message

It does not even reach the controller method. However, works fine if I only try to append a single file. The funny thing is that I’ve written this functionality in different project and works well there.

I tried passing an array of blobs instead of appending them one by one to formData but that does not work either. Any help would be appreciated.