Saves segment of the resource from the specified stream to the WebDAV repository.
Instance of WebDAVResponse representing operation status.
If totalContentLength is -1 the segment parameter contains entire resource content. The startIndex parameter is always 0 in this case.
public WebDAVResponse SaveFromStream(long startIndex, long totalContentLength, Stream segment, string contentType)
{
if (!ClientHasToken)
return new LockedResponse();
long read = 0;
try
{
read = WriteContent(segment, contentType, totalContentLength, startIndex);
}
catch (HttpListenerException)
{
//We came here because there were troubles with connection.
//We want to keep content but return ResumeIncompleteResponse,
//so engine knows we havn't finished uploading.
}
if (startIndex + read < totalContentLength)
{
return new ResumeIncompleteResponse();
}
else if (read > 0)
{
return new OkResponse();
}
else
{
return new NoContentResponse();
}
}
IResumableUpload Interface | ITHit.WebDAV.Server.ResumableUpload Namespace