Click an image in jsp to bring up the file upload interface and implement preview instance details. jsp file upload

Source: Internet
Author: User

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!

Related Article

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.