UploadToCloud
Structure
UploadToCloud(sService, sFileName, sFolder: Text; bOverwrite, bAllowAuth: Boolean): Text
Type
Function
Description
This function will attempt an upload of the sFileName file to the cloud service specified in sService. The function will return 'SUCCESS' if the upload was successful - otherwise the error condition will be returned. If the sFolder parameter is specified then the file will be uploaded to that folder. If the folder does not exist it will be automatically created. If the sFolder parameter is empty then the file will be uploaded to the root directory. If the bOverwrite parameter is True and a file by this name already exists in the Cloud then the file will first be deleted before upload. Upon execution, if no token exists for the cloud service AND the bAuth parameter is True then the service's login screen will be shown in a browser window. This token will be remembered for future sessions.
Parameters: 5
sService = the name of the online cloud service. Acceptable values are: 'BOX' (box.com) and 'DROPBOX' (dropbox.com)
sFileName = the name of file to be uploaded (NOT directory). The file must exist in IndySoft Temp directory
sFolder = optional folder in Cloud where the file should be uploaded. If this parameter is empty then the file will be uploaded to the root directory.
bOverwrite = if the bOverwrite parameter is True and a file by this name already exists in the Cloud then the file will first be deleted before upload.
bAllowAuth = If previous tokens saved to the database are not found and/or do not allow access to the online service, this parameter determines if a browser window should be shown to allow for credentials to be entered. If this script is intended to be run in an automated/unattended setup, then this parameter should be set to False.
Return Value
Text
Examples
sCompany = "ABC COMPANY"
sEquip = "ABC123"
sFileName = sCompany & "-" & sEquip & ".zip"
sResult = ExportAsset(sCompany, sEquip, sFileName, "")
if sResult = "SUCCESS" then
sResult = UploadToCloud("DROPBOX", sFileName, "", False, False)
if sResult <> "SUCCESS" then
ShowMessage("Upload was not completed: " & sFileName)
End If
DeleteTempFile(sFileName)
End If |