I want to upload a file (VideoFile) to the server via BackgroundTransferService .
My problem is that I also want to send 2 parameters along with the file (POST request).
So, is it possible to send parameters along with file BackgroundTransferService using the BackgroundTransferService API ..?
Code with BackgroundTransferService :
BackgroundTransferRequest req = new BackgroundTransferRequest(new Uri("ServerURL", UriKind.Absolute)); req.Method = "POST"; req.TransferPreferences = TransferPreferences.AllowCellularAndBattery; string uploadLocationPath = "/Shared/Transfers/myVideoFile.mp4"; string downloadLocationPath = "/Shared/Transfers/response.txt"; req.UploadLocation = new Uri(uploadLocationPath, UriKind.Relative); req.DownloadLocation = new Uri(downloadLocationPath, UriKind.Relative); req.TransferProgressChanged += req_TransferProgressChanged; req.TransferStatusChanged += req_TransferStatusChanged; try { BackgroundTransferService.Add(req); } catch (Exception ex) { MessageBox.Show("Unable to add video to upload queue.\nPlease try again later.", App.appName, MessageBoxButton.OK); }
Please ask if anyone wants more information and cannot understand my question.
I need a quick answer. Yes or No .. and if so, how ..?
source share