DWQA QuestionsCategory: ProgramObject storage upload consultation

The front and back ends of springboot are separated. The front end selects the file, calls the back-end upload interface, and then uploads the file to the object storage. Is the upload progress done at the front end? Is the back-end call upload object storage asynchronous? At present, if the test is to upload synchronously, if it is a large file, the front-end upload to the back-end upload is finished, but because it has to be uploaded to the object storage, it will take a while for the request to end. How to deal with this better?,It’s good to pass the web directly to cloud storage. You don’t need to go through your own server. Why waste that bandwidth.As far as I know, the file upload interface of cloud storage service is in formdata format. In fact, what your back-end interface needs to return is just a few data:

  • To upload the actual URL of the file, it is usually pre signed. The client just post to this address.
  • What is the key of the subkey of the file object in formdata (that isformData.append()The first parameter of).
  • Other additional parameters (if any) are required in formdata.
  • Other additional parameters (if any) are required in the request headers.

The front end takes the above data through the back-end interface, and then assembles it into an Ajax and directly uploads it to cloud storage.Combined with the question I answered before, if you want to change cloud storage, just change the configuration in the background, which is insensitive to the front end.P. S. unless there is a case where server transfer is required, that is, your business system requires extremely high security for file transmission, and you don’t want clients to bypass you and communicate directly with cloud storage services.

1 Answers
Then go hiking answered 2 months ago

It’s good to pass the web directly to cloud storage. You don’t need to go through your own server. Why waste that bandwidth.As far as I know, the file upload interface of cloud storage service is in formdata format. In fact, what your back-end interface needs to return is just a few data:

  • To upload the actual URL of the file, it is usually pre signed. The client just post to this address.
  • What is the key of the subkey of the file object in formdata (that isformData.append()The first parameter of).
  • Other additional parameters (if any) are required in formdata.
  • Other additional parameters (if any) are required in the request headers.

The front end takes the above data through the back-end interface, and then assembles it into an Ajax and directly uploads it to cloud storage.Combined with the question I answered before, if you want to change cloud storage, just change the configuration in the background, which is insensitive to the front end.P. S. unless there is a case where server transfer is required, that is, your business system requires extremely high security for file transmission, and you don’t want clients to bypass you and communicate directly with cloud storage services.

okay, thank you. Many people who read online and asked in the group said back-end upload

Then go hiking replied 2 months ago

If the server bandwidth and traffic management are enough, you can of course choose to transit through the server.

Then go hiking replied 2 months ago

In other words, it’s OK to upload such small pictures as user avatars on your server. If you upload files such as several gigabytes of videos at any time

Um. good The big one can only be used in the front end

_usw replied 2 months ago

If the front end is directly to cloud storage, what does it feel exposed

Then go hiking replied 2 months ago

Besides revealing which cloud storage you use, what else? In fact, which CDN do you use for the interview is also exposed? Or do you think cloud storage service providers are more sensitive than CDN service providers? If you really don’t want it, that’s what I said at the end“I don’t want clients to bypass you and communicate directly with cloud storage services”In the category.