This article describes in detail how to bypass the server through js + plupload and batch upload images to youpai cloud, which is very clever and saves server resources, here we recommend you to friends who need it. Forums or post bars often need to share a lot of images. The poor way to upload images is to upload them to the central server, and then the central server forwards them to the static image server. This article describes how to use plupload to optimize the upload process, and how to directly upload images to the cloud in batches without bypassing the server. This article focuses on the following:
The Code is as follows:
Plupload Library
Local Image Compression
Select multiple images
Directly upload images to youpai cloud in batches without bypassing the server
Use youpai HTTP FORM API
Plupload Configuration
Plupload Library
Plupload is a rich Image Upload plug-in. You can use Flash, Silverligh, and html4 to batch upload in earlier browsers. In later browsers, the html5 interface is used to upload files first, and all the judgments are automatic, it can be said that it is very convenient to use! In addition, plupload also supports image compression on the client, direct Drag & Drop for upload, and other functions. For more information, visit its official website.
Here, we only use its core API and only need to introduce a file.
The Code is as follows: