First of all, I would like to state that this is a secondary encapsulation of the WebUploader open source upload control, and the underlying layer is still implemented by WebUploader, just to use it more concisely.
Let's take a look at WebUploader
Introduction:
WebUploader is a simple HTML5-based modern file upload component developed by the Baidu WebFE (FEX) team. In modern browsers, it can give full play to the advantages of HTML5, while not abandoning the mainstream IE browser, using the original FLASH runtime, compatible with IE6+, iOS 6+, and Android 4+. The same call method can be used by users at any time when the two sets of runtimes are available.
The use of large file shards and concurrent upload greatly improves the file upload efficiency.
Official website address: http://fex.baidu.com/webuploader/
If you are interested in playing by yourself, you can go directly to the official website
Let's start the text:
From the above, we can see that Baidu's WebUploader function is indeed very powerful, but like all upload controls, it is more cumbersome to use, such as the following:
You need to reference a bunch of related libraries first,
Then write the HTML well
We don't want all of these!, just two sentences, get our upload. As follows:
I've written that bootstrap style css will automatically reference,
Support multiple file uploads,
Automatically identify duplicate files,
Optional automatic upload and manual upload,
You can render multiple upload controls in a page without conflict
Then some WebUploader related configuration parameters can be configured by yourself.
Let's go directly to the JS widget I packaged (a bit messy, let's make do):
Some related and more important parameters have been written with notes, and you can refer to them by yourself.
Then let's use him.
Write our JS and HTML as follows:
That's OK, it's worth noting
For the parameters in powerWebUpload, please refer to the API on the official website
The GetFilesAddress() method will return an array of file paths after uploading, and you can get it yourself. Finally, the last demo I wrote, implemented using Asp.net MVC, you can download it yourself:
Baidu Netdisk:
Link: http://pan.baidu.com/s/1o8B0xOQ Password: 9kws
Original: http://www.cnblogs.com/GuZhenYin/p/5584272.html
|