Node uses Multer components to get req.files questions

problem description

problems with uploading files using Multer in nodeJS

the environmental background of the problems and what methods you have tried

the front end receives a base64 string, organizes it into formData, and uses the append method to add it, and sends it to the backend for processing
the specific process and problems in which the backend cannot find req.files, are as follows:

related codes

/ / Please paste the code text below (do not replace the code with pictures)
the backend reads the picture and converts it into a base64 bit string, adds it to the object picBase64 and sends it to the front end. Key is the file name:

.
let data = fs.readFileSync(filedir);                               
data = new Buffer(data).toString("base64");
picBase64[filename]=data;

picBase64 printing of objects received by the front end :

base64formData,fromformData:


formData,req.files,originalFilename:

multer:

formData:

what result do you expect? What is the error message actually seen?

ask the boss to tell me why. Provide some solutions

The

problem is finally solved-_ | | for some reason, there is no URL part that needs to be removed when my image file is transferred to base64 bit, so there is no need to call the split () method. There is also a problem with the decoding method I use. I should use the window.atob () method instead of the window.btoa () method, so that I can get the corresponding message.

Menu