Java servlet uploads the picture to the specified folder and displays the picture
•
Java
In the process of learning servlet, a demo is made for image upload. The functions are: upload the image on page a, click Submit, and save the image to the path specified by the server (D: / image); jump to page B, and page B reads the image showing the absolute path (D: / image). The main steps are as follows:
Step 1: upload page uploadphoto jsp
Two issues need to be noted:
1. The method of form must be post. Get cannot upload files. Enctype = "multipart / form data" should be added to indicate that the submitted data is binary files.
2. You need to provide a field of type = "file" to upload
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码