Discuss this help topic in SecureBlackbox Forum

Clouds: Write data to existing file

To write the data into the existing file use TElDropboxDataStorage.WriteObject() method.

C#:


FileStream input = new FileStream(@"...", FileMode.Open, FileAccess.Read);
try
{
    storage.WriteObject(@"/path/uploaded.bin", input, null);
}
finally
{
    input.Close();
}

If you already have an object of TElDropboxDataStorageObject class, you can use its Write() method.

If the data being uploaded to the server are to be encrypted or signed, you need to take certain additional steps.

Dropbox supports two modes of data upload. The first uploads the data with one HTTP request, and the size of the data should not exceed 150 MiB. To upload a larger file, the second mode is used. It's called "chunked upload" TElDropboxDataStorage automatically selects the needed upload mode, based on the value of ChunkedUploadThreshold property. By default this property is set to 150 MiB, but you can set a smaller value. The size of the chunk, uploaded in each HTTP request, is specified in the ChunkedUploadChunkSize property, and is set to 4 MiB by default.

Use OnProgress event of TElDropboxDataStorage class to track and show the progress of data upload, and interrupt the transfer if necessary.

Unfortunately, Dropbox doesn't allow to write only a part of file, thatís why the TElDropboxDataStorage.WriteBlock() method throws an "unsupported operation" exception.

How To articles about Dropbox cloud

Discuss this help topic in SecureBlackbox Forum