Click an image in jsp to bring up the file upload interface and implement preview instance details. jsp file upload
Click an image in jsp to bring up the file upload interface and implement preview instance details
It took two days to figure out the preview function.
The task requirements are as follows:
1: The jsp page contains an image (pic_1)
2: Click the image to bring up a page similar to the resource manager.
3: select an image and preview it at pic_1.
I tried the following code on IE8 to implement the above functions. I didn't test it in other browsers. If you know how to support multiple browsers, please kindly advise and learn together. Thank you.
<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN "" http://www.w3.org/TR/html4/loose.dtd "> <Html>
Briefly explain the Code:
Input type = "file", I tried to hide the style (style = "display: none"), so that the absolute path cannot be obtained, but fakepath, in order not to display it, it will make it 100% transparent. There is a div with the id of img_2. This div is the initial Page image, click this image to call the method in input type = "file" to implement this function.
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!