调用file_get_contents的多个请求导致错误500“无法打开流:HTTP请求失败!”

I'm developing a REST API with Laravel as the backend of my app. The frontend is made with React/Redux. The server is a Windows IIS machine.

I'm having a problem submiting a list of attachments to a model. The upload process from the frontend is the following one:

  1. User fills a form with a dynamic list of custom file fields.
  2. Every time file is chosen, it uploads the file to a temporary folder using the API, and returns an url of the file.
  3. When the user feels like uploading them all, it loops through all attachment fields and calls the API to create the attachment for the model. The controller receives the temporary URL, fetches the file using file_get_contents, and stores it somewhere else.

So in the end, we can have multiple concurrent requests, each calling file_get_contents to an url located in the same server, which shouldn't be a problem.

Problem is it crashes when I upload more then 1 file, but it's random. So the more files I upload, more probability of crashing. It crashes 100% of the times with more than 3 files. All requests are seen as pending on Chrome dev tools, and after some minutes they return "Error 500 failed to open stream: HTTP request failed!".

Requests

Error

Things I've tried:

  1. Use cURL. Same result.
  2. allow_fopen_url PHP option is On
  3. Firewall is disabled
  4. Tried multiple machines
  5. Requests don't fail if the URL is external to the server, meaning file_get_contents fetches a URL located in another machine.

Looks like a race condition to the filesystem. But I don't understand why, all files that need to be read are different.

Don't know what else to do. Can somebody help?