/// <summary>
/// Uploads a single chunk
/// </summary>
/// <param name="uploadSessionId"></param>
private void UploadSingleChunk(string uploadSessionId, byte [] uploadDataBuffer, int numBytes)
{
var urlAppendChunk = _onlineUrls.Url_AppendFileUploadChunk(_onlineSession, uploadSessionId);
var uploadChunkAsMime = new MimeWriterFileUploadChunk(uploadDataBuffer, numBytes);
var webRequest = this.CreateAndSendMimeLoggedInRequest(urlAppendChunk, "PUT", uploadChunkAsMime); //NOTE: This command requires a PUT not a GET
var response = this.GetWebReponseLogErrors(webRequest, "upload file chunk");
using (response)
{
var xmlDoc = GetWebResponseAsXml(response);
//Get all the workbook nodes
var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
var chunkUploadXml = xmlDoc.SelectSingleNode("//iwsOnline:fileUpload", nsManager);
var verifySessionId = chunkUploadXml.Attributes["uploadSessionId"].Value;
var fileSizeMB = chunkUploadXml.Attributes["fileSize"].Value;
if (verifySessionId != uploadSessionId)
{
this.StatusLog.AddError("Upload sessions do not match! " + uploadSessionId + "/" + verifySessionId);
}
//Log verbose status
this.StatusLog.AddStatus("Upload chunk status " + verifySessionId + " / " + fileSizeMB + " MB", -10);
}
}