Cloud Storage Integrator - Online Help
Cloud Storage Integrator
Questions / Feedback?

UploadFile Method

Uploads a file.

Syntax

box.uploadFile(fileName, [callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err, data){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'data' is the value returned by the method.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

UploadFile uploads a file to the folder specified by ResourceParentId. If ResourceParentId is not specified the file will be uploaded to the root directory. This method returned the Id of the uploaded file. If the file already exists the server will return an error.

The FileName parameter specifies the name of the file. Naming restrictions:

  • Names must be 255 characters or less.
  • Names with non-printable ASCII are not supported.
  • Names with the characters "/", "\", or trailing whitespace are not supported.
  • The special names "." and ".." are not supported.

LocalFile specifies the file to upload. The data to upload may also be set in ResourceData or set by SetUploadStream. To encrypt a file set EncryptionAlgorithm and EncryptionPassword.

The following properties are applicable when calling UploadFile:


box.LocalFile = "../MyFile.zip";
box.UploadFile("MyFile.zip");

After uploading a file the Resource* properties are populated with information about the uploaded file.

 
 
Copyright (c) 2017 /n software inc. - All rights reserved.
Build 1.0.6240.0