void fileUpload_FileUploadCompleted(object sender, FileUploadCompletedEventArgs args) { string id = ctx.Request.QueryString["id"]; //FileInfo fi = new FileInfo(args.FilePath); //string targetFile = Path.Combine(fi.Directory.FullName, args.FileName); //if (File.Exists(targetFile)) // File.Delete(targetFile); //fi.MoveTo(targetFile); }
void client_FileUploadCompleted(object sender, FileUploadCompletedEventArgs e) { if (e.Error == null) { this.textBox1.Text = e.Result.ToString(); this.gInfo.Visibility = System.Windows.Visibility.Visible; this.gPhoto.Visibility = System.Windows.Visibility.Collapsed; this.txtInfo.Text = "You are: \n" + e.Result; } else { this.textBox1.Text = e.Error.Message; } }
public override FileUploadProcessResult ProcessUploadedFile(object sender, FileUploadCompletedEventArgs args) { if (!args.UploadParams.ContainsKey("DFISUploadURL")) { throw new ArgumentException("Please Specify UploadParams[\"DFISUploadURL\"] "); } if (!args.UploadParams.ContainsKey("DFISGroup")) { throw new ArgumentException("Please Specify UploadParams[\"DFISGroup\"] "); } if (!args.UploadParams.ContainsKey("DFISType")) { throw new ArgumentException("Please Specify UploadParams[\"DFISType\"] "); } if (!args.UploadParams.ContainsKey("DFISUserName")) { throw new ArgumentException("Please Specify UploadParams[\"DFISUserName\"] "); } if (!args.UploadParams.ContainsKey("DFISFileName")) { throw new ArgumentException("Please Specify UploadParams[\"DFISFileName\"] "); } string url = args.UploadParams["DFISUploadURL"]; string fileGroup = args.UploadParams["DFISGroup"]; string fileType = args.UploadParams["DFISType"]; string userName = args.UploadParams["DFISUserName"]; string fileName = args.UploadParams["DFISFileName"]; using (FileStream fileStream = new FileStream(args.FilePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { HttpUploader.UploadFile(fileStream, fileName, url, fileGroup, fileType, string.Empty, userName, UploadMethod.Update); } FileUploadProcessResult result = new FileUploadProcessResult(); result.Status = Newegg.Oversea.Silverlight.FileUploadHandler.ProcessStatus.Success; result.ResponseMsg = fileName; return(result); }
private void FileUploadFileUploadCompleted(object sender, FileUploadCompletedEventArgs e) { var dataStore = BlobShareDataStoreEntities.CreateInstance(); try { var blobService = new BlobService( dataStore, CloudStorageAccount.Parse(ConfigReader.GetConfigValue("DataConnectionString")), ConfigReader.GetConfigValue("MainBlobContanier")); try { if (!string.IsNullOrEmpty(e.FileName)) { e.DistributedUpload.Commit(); var resource = new Blob(); resource.BlobId = Guid.Parse(this.ctx.Request.QueryString["id"]); resource.Name = Path.GetFileNameWithoutExtension(e.FileName); resource.Description = string.Empty; resource.OriginalFileName = e.FileName; resource.UploadDateTime = DateTime.UtcNow; blobService.CreateBlob(resource); } } catch (Exception ex) { this.ctx.Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError; this.ctx.Response.StatusDescription = ex.Message; return; } } finally { dataStore.Dispose(); } }
private void OnFileUploadCompleted(FileUploadCompletedEventArgs e) { FileUploadCompleted?.Invoke(this, e); }