Home  >  Article  >  Web Front-end  >  JS limits uploaded image size locally without using controls_Basic knowledge

JS limits uploaded image size locally without using controls_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 17:46:061823browse

The detection before file upload is usually based on the file name to determine whether the file type is legal, but it is difficult to detect the size of the file unless it is done locally or using controls. The word problem can be easily solved using JS. JS can determine the size before uploading the image. This can be achieved with javascript. The effect...//The size of the image file allowed to be uploaded
The specific code is as follows
JS limits uploaded image size locally without using controls_Basic knowledge

Copy code The code is as follows:




< ;legend>Image source
LocalRemote:

Preview area






Note that readers can directly copy the above code and save it as an HTML file to preview JS restrictions Upload image size effect
Statement:
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