c# - How to get filename from UploadFileCompletedEventArgs? -
my goal filename of finished file e.
... webclient webclient = new webclient(); webclient.uploadfileasync(new uri(address, "stor", filename)); ... void webclientuploadcompleted(object sender, uploadfilecompletedeventargs e) { //how filename e? }
uploadfileasync
accepts user state fourth parameter. can change call to:
webclient.uploadfileasync(new uri(address), "stor", filename, filename);
and retrieve in callback:
void webclientuploadcompleted(object sender, uploadfilecompletedeventargs e) { var filename = (string)e.userstate; }
Comments
Post a Comment