Do I have to transfer the uploaded picture to base64 code?

if you want an object in the background, you don"t have to transfer it. If the path in the background is changed to a public network path first, and then send it to the backend god, can you tell me about it? vue development

Jun.15,2022

do you have to transfer the uploaded picture to Base64 code

Don't. If you don't want someone in the background, you just want to save trouble. The problem is that it costs too much.

  1. first transfer the file using multipart/form-data , and then turn to base64 the file size will become much larger.
  2. secondly, if you want to upload files through json , then the body that comes with application/json must be allowed to be big enough (you don't know how big it will be), so if I post a big enough real json to let your server deserialize, you won't collapse?
  3. if the backend only needs the path, then it should provide another interface for you to transfer the file and return the file path, and then you can get the path to submit the data for the second request.

it is best to formData directly. The front end does not have the ability to transfer to a public network address. Usually, a file file is sent to the server to return an image address.


directly convert the binary stream to him

Menu