ASP.Net: Writing chunks of file..HTTP File upload with resume..

Posted by Manish on Stack Overflow See other posts from Stack Overflow or by Manish
Published on 2010-01-15T06:36:26Z Indexed on 2010/06/06 7:32 UTC
Read the original article Hit count: 572

Filed under:
|
|
|

Please refer to question: http://stackoverflow.com/questions/2062852/resume-in-upload-file-control

Now to find a solution for the above question, I want to work on it and develop a user control which can resume a HTTP File Upload process.

For this, I'm going to create a temporary file on server until the upload is complete. Once the uploading is done completely then will just save it to the desired location.

The procedure I have thought of is:

  1. Create a temporary file with a unique name (may be GUID) on the server.
  2. Read a chunk of file and append it to this temp file on the server.
  3. Continue step 1 to 3 until EOF is reached.
  4. Now if the connection is lost or user clicks on pause button, the writing of file is stopped and the temporary file is not deleted.
  5. Clicking on resume again or uploading the same file again will check on the server if the file exists and user whether to resume or to overwrite. (Not sure how to check if it's the same file. Also, how to step sending the chunks from client to server.)
  6. Clicking on resume will start from where it is required to be uploaded and will append that to the file on the server. (Again not sure how to do this.)

Questions:

  1. Are these steps correct to achieve the goal? Or need some modifications?
  2. I'm not sure how to implement all these steps. :-( Need ideas, links...

Any help appreciated...

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET