cloud - Resume Uploading with Azure After Power Failure -


how can resume uploading in azure last disconnect. in network failure can continue have after power failure when system restarted . how can save current state of software (which uploading file azure). if save state can resume last point.i using code uploading.the code internet.

 private void uploadbigfile(){ int count = 0, buffersize = 40 * 1024, blockcount = 0; string filepath = @"d:\dua.zip"; list<string> blockids = new list<string>(); cloudstorageaccount storageaccount = cloudstorageaccount.parse(cloudconfigurationmanager.getsetting("storageconnectionstring")); cloudblobclient blobclient = storageaccount.createcloudblobclient(); cloudblobcontainer container = blobclient.getcontainerreference("mytestcontainer"); container.createifnotexists(); byte[] bufferbytes = new byte[buffersize]; string filename = path.getfilename(filepath); cloudblockblob blob = container.getblockblobreference(filename); using (filestream filestream = file.openread(filepath)){ blockcount = (int)(filestream.length / buffersize) + 1; int64 currentblocksize = 0; int currentcount = blockids.count(); filestream.seek(buffersize * currentcount, seekorigin.begin); (int = blockids.count; < blockcount; i++){ currentblocksize = buffersize; if (i == blockcount - 1){ currentblocksize = filestream.length - buffersize * i; bufferbytes = new byte[currentblocksize];} if (currentblocksize == 0) break; filestream.read(bufferbytes, 0, convert.toint32(currentblocksize)); using (memorystream memorystream = new memorystream(bufferbytes)){ try{ string blockid = convert.tobase64string(encoding.utf8.getbytes(guid.newguid().tostring())); blob.putblock(blockid, memorystream, null); blockids.add(blockid); count++; label1.text = convert.tostring(count); label1.refresh();} catch (exception){}}}} blob.putblocklist(blockids);} 

if you're keeping track of blocks, can save position , restart it. here's blog article uploading large files; end of tells how you're trying do.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -