When uploading a file, why upload it to the tomcat server first, and then from the tomcat server to the FTP server?

recently, I was looking at an open source project and found that when I found the file upload function, I would first set up a temporary folder in the tomcat server. The whole process is divided into three steps:

1. Upload the front-end files first stored in the tomcat server temporary folder
2.tomcat server temporary folder, and upload the files to the ftp server
3. Delete files under the tomcat snack folder

question: why upload it to the temporary folder of the tomcat server first? In the backend service business method, is it impossible to read the front-end stream directly and transfer it to the ftp server without writing it to the tomcat? Isn"t it superfluous to upload the file to tomcat before deleting it?

Jul.07,2021

  1. Tomcat should be able to write directly to the FTP server, probably because the open source component is not implemented.
  2. Tomcat can directly intercept the uploaded stream object, and then directly write to the FTP stream object without caching the file.
  3. the front end cannot be written directly to the FTP server without relying on plug-ins, because browsers only support HTTP, by default and do not support FTP protocol, unless the FTP server supports FTP protocol while supporting point-to-point HTTP upload interface

you have to communicate with tomocat. Ask him why?


you can also send js to oss

directly.
Menu