Upload | no components
A few months ago, wrote about ASP no component upload with progress bar blog, at that time the main analysis of the Web file upload and in the background to obtain analysis of the implementation of the principle of data. The implementation of the progress bar is the fundamental to achieve the block to obtain data, according to the block size and number of blocks to record the uploaded size. There are some specific details that were not clearly stated at the time:
Q: How is progress information accessed?
A: Progress information is saved in application, and a progress ID is generated each time it is uploaded, and the current upload progress information in application can be retrieved based on this progress ID.
Q: What form is the progress information stored in the application?
A:asp is too weak, I tried scripting.dictionary and xmldom, but the ASP application can not save this object, if the asp.net can be directly used Hashtable. Finally, a Adodb.recordset object is used in application to save progress related information.
Q: How to ensure that the page can immediately respond to display progress bar information?
A:
To close session state with <% @enablesessionstate =false%> declaration at the beginning of the file
To ensure that caching is disabled:
Response.CacheControl = "No-cache"
Response.Expires =-1
Q: Can upload a large number of files?
A: This and the speed, server memory and other factors related to the server.scripttimeout set long enough, then theoretically can stay connected with the server for a long time. Because you cannot implement append writes to a file in ASP, you must store all the data that you want to write to in memory, so that if you upload a large file, it will take up server memory (a text file can append writes using Textstream.write). Under the asp.net is more cool, when the block reading, each read a piece of analysis, and then upload the data content "append" to the hard disk file, the memory footprint is very small. The general dozens of MB file is still no problem, too large upload is not very meaningful for the web.
Write a more complete example, you can download the use of:
Demo Downloads
Http://www.webuc.net/MyProject/upload/upload.rar