Uploading large files directly on the webpage has always been a headache. This article will introduce the html5 multipart and multipart upload methods for large files, if you are interested, refer to the solution in this article. Direct uploading of large files on webpages has always been a headache. There are two main problems: first, if an error occurs during a long upload period, the previous task will be abandoned; second, the server configuration is complex. You need to consider receiving large forms and timeout issues. If it is a hosted host, you may not be able to change the configuration. By default, you can only receive attachments smaller than 4 MB.
The ideal solution is to split large files and upload them to the server in one piece, and then merge them by the server. The advantage of this is that once the upload fails, only one part is lost, and the whole file is not re-transmitted, and the size of each part can be controlled within 4 MB. The server can adapt without any settings.
The common solution is RIA. Taking flex as an example, the file is usually loaded using the FileReference. load method to get the ByteArray, and then the form is constructed in parts (high versions of flash do not allow direct access to the file ). However, this load method can only load small files, which cannot exceed 300 MB. Therefore, the load method is not very applicable.
Fortunately, now with HTML5, we can directly construct parts. This is a very gratifying improvement, but unfortunately it is not widely used currently (IE, IE, really hate your teeth ).
Let's get down to the point. Let's look at a DEMO, Based on ASP. Net MVC3, which is just an example. Many problems have been simplified.
The main feature is the client. The new features are shown here:
<% @ Page Language = "C #" Inherits = "System. Web. Mvc. ViewPage
"%>
Example of multipart upload of HTML5 large files