Discuss this help topic in SecureBlackbox Forum

Clouds: Upload file

To upload the file to the server

  1. Obtain the TElBoxFolder object for the folder, to which the new file is to be placed.
  2. Call TElBoxFolder.CreateObject() method of the above object, and pass it the name of the new file and the stream, the data from which are to be uploaded to the new file. After uploading the method will return TElBoxFile object for the newly created file.
  3. If the object, returned by CreateObject() method, is not needed, call Release() method of this object to release it.

C#:


TElBoxFolder folder = storage.AcquireFolder(@"...");
try
{
    Console.WriteLine("Folder: {0} (size = {1})\n", folder.Name, folder.Size);

    FileStream source = new FileStream("uploaded.bin",
                                       FileMode.Open, FileAccess.Read);
    try
    {
        TElBoxFile file = folder.CreateObject("uploaded.bin", source,
                                                null) as TElBoxFile;
        file.Release();
    }
    finally
    {
        source.Close();
    }
}
finally
{
    folder.Release();
}

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

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

How To articles about Box.com cloud

Discuss this help topic in SecureBlackbox Forum