Referring to some information on the Internet recently, the client has initially reached the expected goal (the client has not found any good methods for obtaining the upload progress, but has not yet implemented it ), iframe is used to implement the resumable upload of attachments (in fact, iframe is submitted). In order to facilitate the use, it is finally made ,.. net user-defined control:
Example:
The effect of the control page is only the image of "add attachment". Run 1:
Click the image pop-up file selection box and run 2.
Open the selected file, start uploading the file, and click"Stop"Button," uploading "to" waiting for upload "," Stopping "to" uploading ", and" running 3"
Because the attachment size is limited or the page access times out, the upload fails. Run 4
The button is a server button that can be added with the js verification function:
Button1.Attributes. Add ("onclick", "return checkFileState ();");
Run 5:
Delete the file that failed to be uploaded. Run 6:
After submission, you can get the name of the uploaded attachment in cs. In Fileup. ashx, the file is renamed by time. To avoid duplication, you can add a few random numbers at the end.
Run 7:
In the cs file:
Copy codeThe Code is as follows:
Public partial class _ Default: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{
Button1.Attributes. Add ("onclick", "return checkFileState ();");
}
Protected void button#click (object sender, EventArgs e)
{
Response. Write (FilePostCtr1.value );
}
}
Package and download code