java background project upload file placement path

The traditional uploaded files of java projects will be placed in the project root directory to create a folder to place the uploaded files, but when multiple people publish or use automated deployment tools, they often misuse or forget to back up the upload folder, resulting in the loss of uploaded pictures, materials, videos, etc. ;


1: The traditional way of directly uploading files to the project and directory access is very convenient, but the server access path + the relative path of the file storage can be

<Context path="/safety/upload/" docBase="/Users/duandazhi/Desktop/"></Context>
 <!-- docBase can be a relative directory, and a relative directory is relative to appBase -->
<Context path="/safety/upload/" docBase="../safetyUploadRoot/upload"></Context>
The same directory as webapp, ueditor is also under the upload directory
Note that the above two directories must be submitted and built, otherwise tomcat may fail to start
2: Write a mutually prepared bat script to execute the task plan irregularly every day under Windows
3: The files uploaded by LemonOa are all outside the webapp, that is, the download display needs to implement a controller
LemonOA currently defines a parameter store.baseDir as the root directory of all attachments, and then reads this directory as the root. Different modules are distinguished by different prefixes. The directory adopts the method of time + uuid to avoid duplication. The relative path and Metadata such as filenames.
Yes, there is no difference in uploading, but a controller is required for downloading and displaying, so it is more troublesome than putting it in a webapp
If you want to do it better, you have to deal with fileName and content-type when downloading and displaying, so the workload will be more

; But if operating tomcat is not careful, it is easy to lose data when publishing;

Solution (configure in tomcat):

blog1 ( Tomcat configures virtual paths to separate uploaded files from server and project files )

blog 2  http://blog.csdn.net/j080624/article/details/54923785

blog3:   Configure virtual paths in tomcat when javaweb uploads files

blog4: http://www.cnblogs.com/love540376/p/4999616.html




Baidu UEditor upload component uses virtual path mapping configuration [the method is not good to infect the code]

Solve the problem of ueditor uploading files to the virtual path of tomcat [[OK]]


Context path="/safety/upload/" docBase="/Users/duandazhi/Desktop/"></Context>
 <!-- docBase can be a relative directory, and a relative directory is relative to appBase -->
<Context path="/safety/upload/" docBase="../safetyUploadRoot/upload"></Context>
The same directory as webapp, ueditor is also under the upload directory
Note that the above two directories must be submitted and built, otherwise tomcat may fail to start
2: Write a mutually prepared bat script to execute the task plan irregularly every day under Windows
3: The files uploaded by LemonOa are all outside the webapp, that is, the download display needs to implement a controller
LemonOA currently defines a parameter store.baseDir as the root directory of all attachments, and then reads this directory as the root. Different modules are distinguished by different prefixes. The directory adopts the method of time + uuid to avoid duplication. The relative path and Metadata such as filenames.
Yes, there is no difference in uploading, but a controller is required for downloading and displaying, so it is more troublesome than putting it in a webapp
If you want to do it better, you have to deal with fileName and content-type when downloading and displaying, so the workload will be more



 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325693884&siteId=291194637