private static async Task <UploadOperation> CreateUploadOperationForCreateImage( IStorageFile file, string token, BackgroundUploader uploader) { const string boundary = "imgboundary"; List <BackgroundTransferContentPart> parts = new List <BackgroundTransferContentPart>(); BackgroundTransferContentPart metadataPart = new BackgroundTransferContentPart("token"); metadataPart.SetText(token); //metadataPart.SetText("iamatoken"); parts.Add(metadataPart); BackgroundTransferContentPart imagePart = new BackgroundTransferContentPart("photo", file.Name); imagePart.SetFile(file); imagePart.SetHeader("Content-Type", file.ContentType); parts.Add(imagePart); return (await uploader.CreateUploadAsync( new Uri(HttpFotosSapoPtUploadpostHtmlUri), parts, "form-data", boundary)); }
private async void UploadSingleFile(Uri uri, StorageFile file) { if (file == null) { rootPage.NotifyUser("No file selected.", NotifyType.ErrorMessage); return; } BasicProperties properties = await file.GetBasicPropertiesAsync(); if (properties.Size > maxUploadFileSize) { rootPage.NotifyUser(String.Format(CultureInfo.CurrentCulture, "Selected file exceeds max. upload file size ({0} MB).", maxUploadFileSize / (1024 * 1024)), NotifyType.ErrorMessage); return; } BackgroundUploader uploader = new BackgroundUploader(); uploader.SetRequestHeader("Filename", file.Name); UploadOperation upload = uploader.CreateUpload(uri, file); Log(String.Format(CultureInfo.CurrentCulture, "Uploading {0} to {1}, {2}", file.Name, uri.AbsoluteUri, upload.Guid)); // Attach progress and completion handlers. await HandleUploadAsync(upload, true); }
// 加载全部上传任务 private async Task LoadUploadAsync() { IReadOnlyList <UploadOperation> uploads = null; try { // 获取所有后台上传任务 uploads = await BackgroundUploader.GetCurrentUploadsAsync(); } catch (Exception ex) { WriteLine(ex.ToString()); return; } if (uploads.Count > 0) { List <Task> tasks = new List <Task>(); foreach (UploadOperation upload in uploads) { // 监视指定的后台上传任务 tasks.Add(HandleUploadAsync(upload, false)); } await Task.WhenAll(tasks); } }
private void AttachNotifications(BackgroundUploader uploader, IUpload upload) { var successToast = ToastContentFactory.CreateToastText02(); successToast.Audio.Content = ToastAudioContent.SMS; successToast.TextHeading.Text = _locService["Toast_Uploads_SuccessReturn_Text"]; successToast.TextBodyWrap.Text = upload.Uploadable.Name; var successXml = successToast.GetXml(); ToastAudioHelper.SetSuccessAudio(successXml); var successNotification = new ToastNotification(successXml); var failToast = ToastContentFactory.CreateToastText02(); failToast.Audio.Content = ToastAudioContent.IM; failToast.TextHeading.Text = _locService["Toast_Uploads_Fail_Text"]; failToast.TextBodyWrap.Text = upload.Uploadable.Name; var failXml = failToast.GetXml(); ToastAudioHelper.SetFailAudio(failXml); var failNotification = new ToastNotification(failXml); uploader.SuccessToastNotification = successNotification; uploader.FailureToastNotification = failNotification; }
private static async Task <UploadOperation> CreateUploadOperationForCreateVideo( IStorageFile file, string token, BackgroundUploader uploader) { const string boundary = "videoboundary"; List <BackgroundTransferContentPart> parts = new List <BackgroundTransferContentPart>(); BackgroundTransferContentPart metadataPart = new BackgroundTransferContentPart("token"); metadataPart.SetText(token); //metadataPart.SetText("iamatoken"); parts.Add(metadataPart); BackgroundTransferContentPart videoPart = new BackgroundTransferContentPart("content_file", file.Name); videoPart.SetFile(file); videoPart.SetHeader("Content-Type", file.ContentType); parts.Add(videoPart); return (await uploader.CreateUploadAsync( new Uri(AddVideoPostUri), parts, "form-data", boundary)); }
// 新增一个上传任务(一次请求上传一个文件) private async void btnAddUpload_Click(object sender, RoutedEventArgs e) { // 上传服务的地址 Uri serverUri = new Uri("http://localhost:44914/api/Upload", UriKind.Absolute); StorageFile sourceFile; try { // 需要上传的文件 sourceFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/hololens.jpg", UriKind.Absolute)); } catch (Exception ex) { WriteLine(ex.ToString()); return; } // 实例化 BackgroundUploader,并设置 http header BackgroundUploader backgroundUploader = new BackgroundUploader(); backgroundUploader.SetRequestHeader("Filename", "hololens.jpg"); // 任务成功后弹出指定的 toast 通知(类似的还有 SuccessTileNotification, FailureToastNotification, FailureTileNotification) backgroundUploader.SuccessToastNotification = GetToastNotification(); // 创建一个后台上传任务,此任务包含一个上传文件 UploadOperation upload = backgroundUploader.CreateUpload(serverUri, sourceFile); // 以流的方式创建一个后台上传任务 // await backgroundUploader.CreateUploadFromStreamAsync(Uri uri, IInputStream sourceStream); // 处理并监视指定的后台上传任务 await HandleUploadAsync(upload, true); }
public override IHttpTask Upload(TaskConfiguration config) { if (String.IsNullOrWhiteSpace(config.LocalFilePath)) { throw new ArgumentException("You must set the local file path when uploading"); } if (!File.Exists(config.LocalFilePath)) { throw new ArgumentException($"File '{config.LocalFilePath}' does not exist"); } var task = new BackgroundUploader { Method = config.HttpMethod, CostPolicy = config.UseMeteredConnection ? BackgroundTransferCostPolicy.Default : BackgroundTransferCostPolicy.UnrestrictedOnly }; foreach (var header in config.Headers) { task.SetRequestHeader(header.Key, header.Value); } // seriously - this should not be async! var file = StorageFile.GetFileFromPathAsync(config.LocalFilePath).AsTask().Result; var operation = task.CreateUpload(new Uri(config.Uri), file); var httpTask = new UploadHttpTask(config, operation, false); this.Add(httpTask); return(httpTask); }
public async Task <DavItem> Upload(Uri url, StorageFile file) { if (!url.IsAbsoluteUri) { url = new Uri(_serverUrl, url); } BackgroundUploader uploader = new BackgroundUploader(); uploader.CostPolicy = ExecutionContext.Instance.IsBackgroundTask ? BackgroundTransferCostPolicy.UnrestrictedOnly : BackgroundTransferCostPolicy.Always; uploader.Method = "PUT"; var buffer = CryptographicBuffer.ConvertStringToBinary(_credential.UserName + ":" + _credential.Password, BinaryStringEncoding.Utf8); var token = CryptographicBuffer.EncodeToBase64String(buffer); var value = new HttpCredentialsHeaderValue("Basic", token); uploader.SetRequestHeader("Authorization", value.ToString()); var upload = uploader.CreateUpload(url, file); Progress <UploadOperation> progressCallback = new Progress <UploadOperation>(async operation => await OnUploadProgressChanged(operation)); var task = upload.StartAsync().AsTask(progressCallback); var task2 = await task.ContinueWith(OnUploadCompleted); return(await task2); }
public override IObservable <HttpTransfer> WhenUpdated() => Observable.Create <HttpTransfer>(async(ob, ct) => { var downloads = await BackgroundDownloader .GetCurrentDownloadsAsync() .AsTask(); foreach (var download in downloads) { download .AttachAsync() .AsTask( ct, new Progress <DownloadOperation>(_ => ob.OnNext(download.FromNative()) ) ); } var uploads = await BackgroundUploader .GetCurrentUploadsAsync() .AsTask(); foreach (var upload in uploads) { upload .AttachAsync() .AsTask( ct, new Progress <UploadOperation>(_ => ob.OnNext(upload.FromNative()) ) ); } });
public HttpTransferTasks() { BackgroundUploader .GetCurrentUploadsAsync() .AsTask() .ContinueWith(result => { foreach (var task in result.Result) { var config = new TaskConfiguration(task.RequestedUri.ToString(), task.SourceFile.Path) { HttpMethod = task.Method, UseMeteredConnection = task.CostPolicy != BackgroundTransferCostPolicy.UnrestrictedOnly }; this.Add(new UploadHttpTask(config, task, true)); } }); BackgroundDownloader .GetCurrentDownloadsAsync() .AsTask() .ContinueWith(result => { foreach (var task in result.Result) { var config = new TaskConfiguration(task.RequestedUri.ToString()) { HttpMethod = task.Method, UseMeteredConnection = task.CostPolicy != BackgroundTransferCostPolicy.UnrestrictedOnly }; this.Add(new DownloadHttpTask(config, task, true)); } }); }
public async Task <ResponseInfo> UploadAsync(string remoteUri, string[] files, bool toastNotify = true) { uploader = new BackgroundUploader(); uploader.Method = "POST"; if (notifyTemplate != null && toastNotify) { uploader.SuccessToastNotification = new Windows.UI.Notifications.ToastNotification(notifyTemplate); } List <BackgroundTransferContentPart> parts = new List <BackgroundTransferContentPart>(); foreach (var f in files) { StorageFile storageFile = await StorageFile.GetFileFromPathAsync(f); if (storageFile != null) { BackgroundTransferContentPart part = new BackgroundTransferContentPart("file", storageFile.Name); part.SetFile(storageFile); parts.Add(part); } } UploadOperation uploadOpration = await uploader.CreateUploadAsync(new Uri(remoteUri), parts, "form-data"); return(await GetUploadResponse(uploadOpration)); }
public async void Start() { try { var downloads = await BackgroundDownloader .GetCurrentDownloadsAsync() .AsTask(); foreach (var dl in downloads) { dl.Resume(); } var uploads = await BackgroundUploader .GetCurrentUploadsAsync() .AsTask(); foreach (var ul in uploads) { ul.StartAsync(); } } catch (Exception ex) { Log.Write(ex); } }
private async Task <UploadOperation> synchronizePicture(Picture _picture, String _pathAlbum, int _index, TripSummary _summary) { StorageFile _file; BackgroundUploader _uploader = new BackgroundUploader(); UploadOperation _upload = null; String _request = API_FILES_PUT + "/sandbox/" + _pathAlbum + "/" + _picture.Name + _picture.Extension + "?access_token=" + Token + "&overwrite=true"; try { if (_summary.Sample) { _file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///appdata/" + _summary.PathThumb + "/" + _summary.PicturesThumb[_index % 4])); } else { _file = await StorageFile.GetFileFromPathAsync(_picture.GetPath()); } } catch (FileNotFoundException) { return(null); } try { _upload = _uploader.CreateUpload(new Uri(_request), _file); } catch (Exception e) { Debug.WriteLine(e.Message); } return(_upload); }
private async void StartMultipartUpload_Click(object sender, RoutedEventArgs e) { // By default 'serverAddressField' is disabled and URI validation is not required. When enabling the text // box validating the URI is required since it was received from an untrusted source (user input). // The URI is validated by calling Uri.TryCreate() that will return 'false' for strings that are not valid URIs. // Note that when enabling the text box users may provide URIs to machines on the intrAnet that require // the "Home or Work Networking" capability. Uri uri; if (!Uri.TryCreate(serverAddressField.Text.Trim(), UriKind.Absolute, out uri)) { rootPage.NotifyUser("Invalid URI.", NotifyType.ErrorMessage); return; } // Verify that we are currently not snapped, or that we can unsnap to open the picker. if (ApplicationView.Value == ApplicationViewState.Snapped && !ApplicationView.TryUnsnap()) { rootPage.NotifyUser("File picker cannot be opened in snapped mode. Please unsnap first.", NotifyType.ErrorMessage); return; } FileOpenPicker picker = new FileOpenPicker(); picker.FileTypeFilter.Add("*"); IReadOnlyList <StorageFile> files = await picker.PickMultipleFilesAsync(); if (files.Count == 0) { rootPage.NotifyUser("No file selected.", NotifyType.ErrorMessage); return; } List <BackgroundTransferContentPart> parts = new List <BackgroundTransferContentPart>(); for (int i = 0; i < files.Count; i++) { BackgroundTransferContentPart part = new BackgroundTransferContentPart("File" + i, files[i].Name); part.SetFile(files[i]); parts.Add(part); } BackgroundUploader uploader = new BackgroundUploader(); UploadOperation upload = await uploader.CreateUploadAsync(uri, parts); String fileNames = files[0].Name; for (int i = 1; i < files.Count; i++) { fileNames += ", " + files[i].Name; } Log(String.Format("Uploading {0} to {1}, {2}", fileNames, uri.AbsoluteUri, upload.Guid)); // Attach progress and completion handlers. await HandleUploadAsync(upload, true); }
public async Task CancelAll() { var uploads = await BackgroundUploader.GetCurrentUploadsAsync(); foreach (var upload in uploads) { upload.AttachAsync().Cancel(); } }
private void UploadButton_Click(object sender, EventArgs e) { if (!ValidateForm()) { return; } BackgroundUploader.RunWorkerAsync(); }
protected override async Task <IEnumerable <HttpTransfer> > GetUploads(QueryFilter filter) { var items = await BackgroundUploader .GetCurrentUploadsAsync() .AsTask(); return(items .Select(x => x.FromNative()) .ToList()); }
public ActionResult Index() { BackgroundUploader bgUploader = GetUploader(); if (bgUploader.Progress < 100) { return(PartialView("Upload", bgUploader)); } return(PartialView("Show", bgUploader)); }
protected async override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); var currentUploads = await BackgroundUploader.GetCurrentUploadsAsync(); if (currentUploads.Count > 0) { _cts.Cancel(); _cts.Dispose(); } }
/// <summary> /// Gets uploader from session or creates a new one /// </summary> private BackgroundUploader GetUploader() { BackgroundUploader bgUploader = Session["bguploader"] as BackgroundUploader; if (bgUploader == null) { bgUploader = new BackgroundUploader(m_cloudinary); Session.Add("bguploader", bgUploader); bgUploader.Upload(); return(bgUploader); } return(bgUploader); }
public async Task <string> CreateVideoAsync(IStorageFile file, Video v) { VideoSubmition videoSubmition = new VideoSubmition { Tags = v.Tags, Title = v.Title, Synopse = v.Synopse }; Video createdVideo = null; try { using (EnsureCredentialsUseContext context = new EnsureCredentialsUseContext( this.Username, this.Password, this.AccessKey, _client.InnerChannel)) { createdVideo = await this._client.AddVideoPostAsync(videoSubmition, null); } } catch (FaultException faultException) { MessageFault messageFault = faultException.CreateMessageFault(); if (messageFault.HasDetail) { string innerErrorXml; using (var xmlReader = messageFault.GetReaderAtDetailContents()) { innerErrorXml = xmlReader.ReadInnerXml(); } if (innerErrorXml != null) { throw new Exception(innerErrorXml); } throw; } } string token = createdVideo.Token; BackgroundUploader uploader = new BackgroundUploader(); UploadOperation uploadOperation = await VideosServiceClient.CreateUploadOperationForCreateVideo(file, token, uploader); await uploadOperation.StartAsync(); return(await GetResponseMessage(uploadOperation)); }
/// <summary> /// Invoked when image add button is clicked and choose the image. /// </summary> /// <param name="sender">The image add button clicked.</param> /// <param name="e">Event data that describes how the click was initiated.</param> private async void ImageUploadButton_Click(object sender, RoutedEventArgs e) { FileOpenPicker picker = FileTypePicker(imagesFilterTypeList); if (picker == null) { return; } images = await picker.PickMultipleFilesAsync(); if (images == null || images.Count == 0) { return; } Image imgImg = new Image { Source = new BitmapImage(new Uri("ms-appx:///Images/Upload/image.png")), Margin = new Thickness(5, 0, 5, 0) }; ToolTip toolTip = new ToolTip(); toolTip.Content = images[0].Name; ToolTipService.SetToolTip(imgImg, toolTip); totalImagePanel.Children.RemoveAt(totalImagePanel.Children.Count - 1); imagePanel.Children.Add(imgImg); List <BackgroundTransferContentPart> imageParts = CreateBackgroundTransferContentPartList(images); Uri uploadUri = new Uri(Constants.DataCenterURI + "Upload.aspx?username="******"Image uplaod error3. Please check your network."); } }
private async void UploadMultipleFiles(Uri uri, IReadOnlyList <StorageFile> files) { if (files.Count == 0) { rootPage.NotifyUser("No file selected.", NotifyType.ErrorMessage); return; } ulong totalFileSize = 0; for (int i = 0; i < files.Count; i++) { BasicProperties properties = await files[i].GetBasicPropertiesAsync(); totalFileSize += properties.Size; if (totalFileSize > maxUploadFileSize) { rootPage.NotifyUser(String.Format(CultureInfo.CurrentCulture, "Size of selected files exceeds max. upload file size ({0} MB).", maxUploadFileSize / (1024 * 1024)), NotifyType.ErrorMessage); return; } } List <BackgroundTransferContentPart> parts = new List <BackgroundTransferContentPart>(); for (int i = 0; i < files.Count; i++) { BackgroundTransferContentPart part = new BackgroundTransferContentPart("File" + i, files[i].Name); part.SetFile(files[i]); parts.Add(part); } BackgroundUploader uploader = new BackgroundUploader(); UploadOperation upload = await uploader.CreateUploadAsync(uri, parts); String fileNames = files[0].Name; for (int i = 1; i < files.Count; i++) { fileNames += ", " + files[i].Name; } Log(String.Format(CultureInfo.CurrentCulture, "Uploading {0} to {1}, {2}", fileNames, uri.AbsoluteUri, upload.Guid)); // Attach progress and completion handlers. await HandleUploadAsync(upload, true); }
public async Task UploadAsync(StorageFile sourceFile, int travelerId, int reservationId, bool isPrivate, int locationId) { var address = isPrivate ? Addresses.UploadPrivateFileUri : Addresses.UploadPublicFileUri; Uri destinationUri = new Uri(string.Format(address, reservationId)); BackgroundUploader uploader = new BackgroundUploader(); uploader.SetRequestHeader("Filename", sourceFile.Name); UploadOperation upload = uploader.CreateUpload(destinationUri, sourceFile); await upload.StartAsync(); var fileAddress = upload.GetResponseInformation().Headers["Location"]; await _data.CreateAzureStorageFileMetadata(new Uri(fileAddress), sourceFile.Name, reservationId, isPrivate, travelerId, locationId); }
public async Task UploadAsync(StorageFile file, int travelerId, Progress <UploadOperation> progressCallback, int reservationId, bool isPrivate) { var address = isPrivate ? Addresses.UploadPrivateFileUri : Addresses.UploadPublicFileUri; Uri destination = new Uri(string.Format(address, reservationId)); BackgroundUploader uploader = new BackgroundUploader(); uploader.SetRequestHeader("Filename", file.Name); UploadOperation upload = uploader.CreateUpload(destination, file); UploadOperation result = await upload.StartAsync().AsTask(); string fileUri = result.GetResponseInformation().Headers["Location"]; await _data.CreateAzureStorageFileMetadata(fileUri, file.Name, reservationId, isPrivate, UserAuth.Instance.Traveler.TravelerId); }
private async void StartUpload_Click(object sender, RoutedEventArgs e) { // By default 'serverAddressField' is disabled and URI validation is not required. When enabling the text // box validating the URI is required since it was received from an untrusted source (user input). // The URI is validated by calling Uri.TryCreate() that will return 'false' for strings that are not valid URIs. // Note that when enabling the text box users may provide URIs to machines on the intrAnet that require // the "Home or Work Networking" capability. Uri uri; if (!Uri.TryCreate(serverAddressField.Text.Trim(), UriKind.Absolute, out uri)) { rootPage.NotifyUser("Invalid URI.", NotifyType.ErrorMessage); return; } FileOpenPicker picker = new FileOpenPicker(); picker.FileTypeFilter.Add("*"); StorageFile file = await picker.PickSingleFileAsync(); if (file == null) { rootPage.NotifyUser("No file selected.", NotifyType.ErrorMessage); return; } BasicProperties properties = await file.GetBasicPropertiesAsync(); if (properties.Size > maxUploadFileSize) { rootPage.NotifyUser(String.Format(CultureInfo.CurrentCulture, "Selected file exceeds max. upload file size ({0} MB).", maxUploadFileSize / (1024 * 1024)), NotifyType.ErrorMessage); return; } BackgroundUploader uploader = new BackgroundUploader(); uploader.SetRequestHeader("Filename", file.Name); UploadOperation upload = uploader.CreateUpload(uri, file); Log(String.Format(CultureInfo.CurrentCulture, "Uploading {0} to {1}, {2}", file.Name, uri.AbsoluteUri, upload.Guid)); // Attach progress and completion handlers. await HandleUploadAsync(upload, true); }
private const int maxUploadFileSize = 100 * 1024 * 1024; // 100 MB /// <summary> /// StartUploadFiles /// </summary> /// <param name="url"></param> /// <param name="files"></param> public async void StartUploadFiles(string url, IReadOnlyList <StorageFile> files) { Uri uri = null; if (!Uri.TryCreate(url, UriKind.Absolute, out uri)) { if (this.ErrorException != null) { this.ErrorException(this, "Please Invalid UploadURl"); } return; } if (files == null || files.Count == 0) { if (this.ErrorException != null) { this.ErrorException(this, "Please Invalid files"); } return; } ulong totalFileSize = 0; for (int i = 0; i < files.Count; i++) { BasicProperties properties = await files[i].GetBasicPropertiesAsync(); totalFileSize += properties.Size; if (totalFileSize > maxUploadFileSize) { if (this.ErrorException != null) { this.ErrorException(this, "Please Invalid maxUploadFileSize"); } return; } } List <BackgroundTransferContentPart> parts = new List <BackgroundTransferContentPart>(); for (int i = 0; i < files.Count; i++) { BackgroundTransferContentPart part = new BackgroundTransferContentPart("File" + i, files[i].Name); part.SetFile(files[i]); parts.Add(part); } BackgroundUploader uploader = new BackgroundUploader(); UploadOperation upload = await uploader.CreateUploadAsync(uri, parts); await HandleUploadAsync(upload, true); }
/// <summary> /// Starts to upload the file as an asynchronous operation. /// </summary> /// <param name="sdkClient">The SDK client.</param> /// <param name="path">The path to the file.</param> /// <param name="file">The file.</param> /// <param name="progress">The progress.</param> public static async Task StartUploadFileAsync(this IDiskSdkClient sdkClient, string path, IStorageFile file, IProgress progress) { try { var uri = new Uri(WebdavResources.ApiUrl + path); var uploader = new BackgroundUploader { Method = "PUT" }; uploader.SetRequestHeader("Authorization", "OAuth " + sdkClient.AccessToken); uploader.SetRequestHeader("X-Yandex-SDK-Version", "winui, 1.0"); var upload = uploader.CreateUpload(uri, file); await HandleUploadAsync(upload, progress, true); } catch (Exception ex) { throw HttpUtilities.ProcessException(ex); } }
private async void StartUpload_Click(object sender, RoutedEventArgs e) { // By default 'serverAddressField' is disabled and URI validation is not required. When enabling the text // box validating the URI is required since it was received from an untrusted source (user input). // The URI is validated by calling Uri.TryCreate() that will return 'false' for strings that are not valid URIs. // Note that when enabling the text box users may provide URIs to machines on the intrAnet that require // the "Home or Work Networking" capability. Uri uri; if (!Uri.TryCreate(serverAddressField.Text.Trim(), UriKind.Absolute, out uri)) { rootPage.NotifyUser("Invalid URI.", NotifyType.ErrorMessage); return; } // Verify that we are currently not snapped, or that we can unsnap to open the picker. if (ApplicationView.Value == ApplicationViewState.Snapped && !ApplicationView.TryUnsnap()) { rootPage.NotifyUser("File picker cannot be opened in snapped mode. Please unsnap first.", NotifyType.ErrorMessage); return; } FileOpenPicker picker = new FileOpenPicker(); picker.FileTypeFilter.Add("*"); StorageFile file = await picker.PickSingleFileAsync(); if (file == null) { rootPage.NotifyUser("No file selected.", NotifyType.ErrorMessage); return; } BackgroundUploader uploader = new BackgroundUploader(); uploader.SetRequestHeader("Filename", file.Name); UploadOperation upload = uploader.CreateUpload(uri, file); Log(String.Format("Uploading {0} to {1}, {2}", file.Name, uri.AbsoluteUri, upload.Guid)); // Attach progress and completion handlers. await HandleUploadAsync(upload, true); }
private async Task UploadSingleFile(StorageFile file, CpuArchitecture fileType) { var uri = new Uri(Constants.PackageUploadServerUrl); var uploader = new BackgroundUploader(); uploader.SetRequestHeader("Filename", file.Name); uploader.SetRequestHeader("Guid", _dataContext.AppDetail.AppSpecification.Guid.ToString()); uploader.SetRequestHeader("AppName", fileType.ToString()); var upload = uploader.CreateUpload(uri, file); //Log(String.Format(CultureInfo.CurrentCulture, "Uploading {0} to {1}, {2}", file.Name, uri.AbsoluteUri, // upload.Guid)); // Attach progress and completion handlers. await HandleUploadAsync(upload, true); }