IPWorks Cloud 2020 iOS Edition

Questions / Feedback?

uploadFile (method)

Uploads a new file resource.

Syntax

- (NSString*)uploadFile:(NSString*)newFilePath;
public func uploadFile(_ newFilePath: String) throws -> String

Remarks

This method uploads a new file resource at the specified NewFilePath in the share currently selected by Share. The path of the newly-created file is returned.

Any parent folders included in NewFilePath must already exist.

If the SendMetadata configuration setting is enabled when this method is called, all items in the Metadata* properties will be sent along with the creation request.

If LocalFile is set the file will be uploaded from the specified path. If LocalFile is not set the data in ResourceData will be used.

To encrypt the file before uploading it, set EncryptionAlgorithm and EncryptionPassword.

Upload Notes

The UploadFile method is a convenience method that performs a resumable file upload. When called, the class first uses CreateFile to initialize a new file entry on the server; and then it fragments the file data into smaller pieces and calls PutRange multiple times in succession to upload those fragments. The fragment size is fixed at 4MB (this is a server limitation that cannot be changed).

During the upload, the FragmentComplete event fires after each fragment is uploaded to indicate overall progress. The class also updates StartByte as necessary to indicate the current offset in the file.

If the upload is interrupted for any reason, resuming it is easy. First, verify that StartByte is populated (if the same instance of the class is used, they should already be populated, and no special action should be needed). Then call UploadFile again to resume the upload at the specified StartByte offset.

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

//The transfer is interrupted and UploadFile() above fails. Later, resume the download.
//Using the same instance StartByte is already populated from the previous upload attempt.
azurefile.UploadFile("MyFile.zip");

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 iOS Edition - Version 20.0 [Build 8265]