c# - S3 Multipart Upload: how can I cancel one? -
i need cancel in-progress download initiated
filetransferutility = new transferutility(/*...*/); var uploadrequest = new transferutilityuploadrequest() /* config parameters... */ filetransferutility.beginupload(uploadrequest, new asynccallback(uploadcomplete), file); i have searched , documentation, can't find way...
rationale: user can pick file upload, , may choose large file, 1gb. need able cancel this.
in worst case, try kill thread entirely, or shut down upload in unclean way, how???
thanks!
i received official answer amazon on this. here reply:
var filetransferutility = new transferutility(/* */); var uploadrequest = new transferutilityuploadrequest(); thread thread = new thread(() => filetransferutility.upload(uploadrequest)); thread.sleep(5000); // if not done in 5 seconds abort if(thread.isalive) thread.abort(); instead of using beginupload/endupload calls, need use upload call wrapped in thread, , heep reference thread.
if user needs cancel, call abort() on thread, cancel upload. of course, need clean partially uploaded files (they bill them!).
as suspected: simple , intuitive, not easy find :)
Comments
Post a Comment