Question of fs.writeFile node concurrency problem

  node.js, question


Need to do a picture upload function

When multiple pictures are uploaded concurrently (two), it is found that the data of the latter picture covers the data of the previous picture.
The result is that two pictures are uploaded and only two pictures of the same picture can be accessed.

Results after uploading

About how to get url and content. .


A regularity


This part is the front-end code. FileList is a collection of objects composed of file type and some other attributes.

When I wrote the front-end code again, I used the flag flag and recursively considering that the sending was out of order.

Flag is used to record the sending order

In fact, it is very simple. Download a Visio, open a flowchart project after installation, upload your business logic, and use the flowchart picture to find the problem.