//上传完成后,比较文件名,然后调用AddAsync添加数据库记录 private void AddFileCompleted(object sender, AddFileCompletedEventArgs e) { //获取服务器端上传的文件名是否更改后的最新 文件名 if (e.Result != null && e.Result.Length > 0) { if (_fileupload != null) { if (e.Result != _fileupload.FILENAME) { _fileupload.FILENAME = e.Result; FileUploadEventArgs ev = new FileUploadEventArgs(); int i = e.Result.LastIndexOf('\\'); ev.FileName = e.Result.Substring(i + 1); ev.FileName_Path = e.Result; Event_Upload(this, ev); } _client.AddAsync(_fileupload); } } else //Check for webservice errors { _file.State = Constants.FileStates.Error; } //Notify progress change OnProgressChanged(); }
private void Event_Upload(object sender, FileUploadEventArgs e) { if (e.FileName != null) { this.FileName = e.FileName; this.FileName_Path = e.FileName_Path; } }
//上传完成后,比较文件名,然后调用AddAsync添加数据库记录 private void AddFileCompleted(object sender, AddFileCompletedEventArgs e) { //获取服务器端上传的文件名是否更改后的最新 文件名 if (e.Result != null && e.Result.Length > 0) { if (_fileupload != null) { if (e.Result != _fileupload.FILENAME) { _fileupload.FILENAME = e.Result; FileUploadEventArgs ev = new FileUploadEventArgs(); int i = e.Result.LastIndexOf('\\'); ev.FileName = e.Result.Substring(i + 1); ev.FileName_Path = e.Result; Event_Upload(this, ev); } _client.AddAsync(_fileupload); } } else //Check for webservice errors _file.State = Constants.FileStates.Error; //Notify progress change OnProgressChanged(); }