Tomcat--Get the upload file path

Source: Internet
Author: User

Recently did the project, used to upload download files, see java--file upload and download.

Requirements: Uploaded files can be placed on any server (that is, different IP), and then can be accessed in different places.

Note: If you place the uploaded file directly under Tomcat's WebApp file on your server, you can access it anywhere when you turn on Tomcat.

Below is the picture storage location, which is stored under Tomcat's WebApps

The access path is as follows

Http://192.168.2.67:8080/asf-logo.png

The front is my host IP and port, followed by the file name of the picture

Now the need to change: The uploaded image is not stored under WebApps, but exists in the computer's D disk, but also need to remotely access to the picture.

The implementation steps are as follows:

1. Modify the Tomcat Server.xml file. Figure below

2. Image upload Location

The access path is as follows

Http://192.168.2.67:8080/Resource/caren/User/1000000001/bg.png




Tomcat--Get the upload file path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.