Asp.net resumable upload,
Using System; using System. data; using System. configuration; using System. collections; using System. web; using System. web. security; using System. web. UI; using System. web. UI. webControls; using System. web. UI. webControls. webParts; using System. web. UI. htmlControls; using System. IO; public partial class DFile: System. web. UI. page {protected void Page_Load (object sender, EventArgs e) {} protected void LinBtnDFile_Click (object sender, EventArgs e) {// create a bit array byte [] buffer = new Byte [10240]; // specify the path of the file to be downloaded. string filePath = @ "D: \ .rar"; // or the file name contains the extension string fileName = Path. getFileName (filePath); Stream fileStream = null; try {// open the file fileStream = new FileStream (filePath, FileMode. open, FileAccess. read, FileShare. read); Response. clear (); // obtain the file size long fileSize = fileStream. length; long sum = 0; if (Request. Headers ["Range"]! = Null) {Response. StatusCode = 206; // an integer that indicates the HTTP output status returned to the client. The default value is 200. Sum = long. parse (Request. headers ["Range"]. replace ("bytes = ",""). replace ("-", "");} if (sum! = 0) {Response. addHeader ("Content-Range", "bytes" + sum. toString () + "-" + (long) (fileSize )). toString () + "/" + fileSize. toString ();} // get some http header information Response. addHeader ("Content-Length", (long) (fileSize-sum )). toString (); Response. contentType = "application/octet-stream"; // obtain the file source Response. addHeader ("Content-Disposition", "attachment; filename =" + HttpUtility. urlEncode (Request. contentEncodin G. getBytes (fileName); // Response. flush (); fileStream. position = sum; // set the current stream Position fileSize = fileSize-sum; // when the file size is greater than 0, it enters the loop while (fileSize> 0) {// determine whether the client is still connected to the server if (Response. isClientConnected) {// obtain the total number of bytes in the buffer. int length = fileStream. read (buffer, 0, 10240); // write data Response. outputStream. write (buffer, 0, length); // sends the buffer output to the client Response. flush (); buffer = new Byte [10240]; fileSize = fileSiz E-length;} else {// exit loop fileSize =-1 ;}} catch (Exception ex) {Response. write ("Error:" + ex. message);} finally {if (fileStream! = Null) {// Close the file fileStream. Close () ;}response. End ();}}}
A piece of aspnet breakpoint resume code
Qq: 652346044
Asp net http resumable upload full version Program
Baidu searches for "C # resumable upload", hoping that the search results will help you.