Two problems in uploading JS Images

if the picture is uploaded, can both binary and base64 be uploaded to the background? Which way is better? Can binary or base6
4 be transferred to the background and saved directly to the database?
another question is what"s the difference between FormData and Blob? It"s all used for binary transmission, right? What I understand is that formData is a collection. Blog is a single file. Is that so? is there any other difference?

Jan.17,2022

this depends on the actual application scenario and what values need to be received by the background, each has its own advantages and disadvantages. Base64 is a long compiled string, if the background can receive it, then you can pass it directly to the background. In this way, you can just take it out and use it, and there is not much difference in converting base64, into binary. It's the same with blob. FormData is to pass the whole file object to the background, where the address is generated by the background, and then the front end takes it out.

Menu