Home >
Web Front-end >
H5 Tutorial >
Utilize the new features of HTML5 to achieve asynchronous upload of image files_html5 tutorial skills
Utilize the new features of HTML5 to achieve asynchronous upload of image files_html5 tutorial skills
PHP中文网
Release: 2016-05-16 15:47:37
Original
1523 people have browsed it
It is very simple and convenient to use the new features of HTML5 to upload files asynchronously. This article mainly shows the JS part and html structure. The code below does not use a third-party library. If there is a reference, please pay attention to some code snippets that are not shown. The effect preview on my side:
1. The file is not selected 2. The file is selected
HTML code part:
Idea: In the code below, I use the z-index attribute of css to hide the input="file” tag under the id=btnSelect element. After triggering the click of the a tag, the file selection box pops up. The masklayer below is used to click the confirm button. Pop-up layer to prevent users from repeatedly clicking the confirmation button. >The code is as follows:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn