For web-based uploads, in fact, there is no need to upload too many things. The default Upload Component of asp.net is enough, and the failure in the ointment is that the upload progress is not reflected, so now we need to add Progress reflection based on the default upload in asp.net.
With regard to the principles of web upload, I have thoroughly analyzed the asp no-component upload progress bar solution, Asp no-component upload with progress bars (continued), I have written a component-less upload progress bar for asp, so I will not repeat it here. I believe many people have read the "ASP. NET, the solution is to use the implicit HttpWorkerRequest, use its GetPreloadedEntityBody and ReadEntityBody methods from IIS to ASP. the pipe created by NET reads data in blocks, analyzes each block and stores it as a temporary file, which is relatively complicated.
To reflect the progress bar in real time, the core technology is to read uploaded data in blocks. When reading each data block, the number of uploaded parts is recorded, you can know the size of the uploaded file and the progress of the current Upload Based on the total size. The specific technique is to use the implied HttpWorkerRequest, and use its GetPreloadedEntityBody and ReadEntityBody methods from IIS to ASP. in pipe created by NET, data is read in blocks, but only in blocks and records the number of uploaded blocks. You do not need to analyze and process uploaded data, this is because the complicated work has been done by the asp.net Upload Component.
According to the principle described above, the specific code is relatively simple. I wrote an example and used a special Progress display page (Progress. aspx). It uses timed refresh (XmlHttp, FF supported) to obtain the current upload progress information and reflect it on the upload page in real time.
Download the code (decompress the package and set the virtual directory to "Upload" for the web directory). Here, the progress bar is implemented by a script. The script code of the individual progress bar is as follows:
Http://www.webuc.net/myproject/progressbar/progressinfo.htm
Http://www.webuc.net/myproject/progressbar/progressbar.rar