Xbase++ Requires Chilkat v11.7.0+
Xbase++
Box: Upload a Large File in Parts and Commit the Session
See more Box Examples
Run the reusable setup once per HttpCurl object, then select names and execute the operation. The setup is repeated here only to make this published example independently runnable. Resolve documents by name, then perform the explicit chunked-upload session, part, and commit loop. Supports 20 MB through 2 GB using int. Saves recovery information and honors bounded commit Retry-After.
See the Box API guide for setup and the complete workflow.
Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oCurl
LOCAL oSetupCommand
LOCAL nSetupReplacements
LOCAL cParentName
LOCAL cFolderName
LOCAL oAuthorizedCommand1
LOCAL nHeaderReplacement1
LOCAL cLocalPath
LOCAL oFile
LOCAL cSizeString
LOCAL oSizeText
LOCAL oSizeMatch
LOCAL nFileSize
LOCAL oHttp
LOCAL oResponse
LOCAL oRequest
LOCAL oSession
LOCAL nPartSize
LOCAL cUploadUrl
LOCAL cCommitUrl
LOCAL oHash
LOCAL cFileDigest
LOCAL oCommit
LOCAL oPartResponse
LOCAL oChunk
LOCAL oRange
LOCAL oDigestHeader
LOCAL nOffset
LOCAL nPartIndex
LOCAL nPartLength
LOCAL nLastByte
LOCAL cPartDigest
LOCAL nAttempts
LOCAL nWaitSeconds
LOCAL oRetryHeader
LOCAL oRetryMatch
LOCAL nCompleted
nSuccess := 0
// Requires Chilkat 11.7.0 or later and a previously unlocked Chilkat bundle.
// See Global Unlock Sample.
// Guide: Box API Guide.
nSuccess := 0
// BEGIN ONE-TIME SETUP
// This block is repeated so each published example can run on its own.
// In an application, run the setup example once and pass the SAME curl object
// to operation code below. Do not recreate it for every operation.
// See Reusable Box HttpCurl Setup.
oCurl := CreateObject("Chilkat.HttpCurl")
oCurl:SetVar("access_token", "BOX_ACCESS_TOKEN")
oCurl:SetVar("parent_name", "/")
// Box's fixed root ID is an implementation detail; callers supply names.
oCurl:SetVar("parent_id", "0")
oSetupCommand := CreateObject("Chilkat.StringBuilder")
// Register findParent; registration sends no request.
oSetupCommand:SetString('curl -X GET "https://api.box.com/2.0/folders/0/items?limit=1000&fields=id,type,name" -H "Authorization: Bearer ACCESS_TOKEN"')
nSetupReplacements := oSetupCommand:Replace("ACCESS_TOKEN", oCurl:GetVar("access_token"))
nSuccess := oCurl:AddFunction("findParent", oSetupCommand:GetAsString())
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
// Register findFolder; registration sends no request.
oSetupCommand:SetString('curl -X GET "https://api.box.com/2.0/folders/{{parent_id}}/items?limit=1000&fields=id,type,name" -H "Authorization: Bearer ACCESS_TOKEN"')
nSetupReplacements := oSetupCommand:Replace("ACCESS_TOKEN", oCurl:GetVar("access_token"))
nSuccess := oCurl:AddFunction("findFolder", oSetupCommand:GetAsString())
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
// Register findFile; registration sends no request.
oSetupCommand:SetString('curl -X GET "https://api.box.com/2.0/folders/{{folder_id}}/items?limit=1000&fields=id,type,name" -H "Authorization: Bearer ACCESS_TOKEN"')
nSetupReplacements := oSetupCommand:Replace("ACCESS_TOKEN", oCurl:GetVar("access_token"))
nSuccess := oCurl:AddFunction("findFile", oSetupCommand:GetAsString())
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
// Register findDestination; registration sends no request.
oSetupCommand:SetString('curl -X GET "https://api.box.com/2.0/folders/0/items?limit=1000&fields=id,type,name" -H "Authorization: Bearer ACCESS_TOKEN"')
nSetupReplacements := oSetupCommand:Replace("ACCESS_TOKEN", oCurl:GetVar("access_token"))
nSuccess := oCurl:AddFunction("findDestination", oSetupCommand:GetAsString())
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
// Register getFileDetails; registration sends no request.
oSetupCommand:SetString('curl -X GET "https://api.box.com/2.0/files/{{file_id}}?fields=id,sha1,file_version" -H "Authorization: Bearer ACCESS_TOKEN"')
nSetupReplacements := oSetupCommand:Replace("ACCESS_TOKEN", oCurl:GetVar("access_token"))
nSuccess := oCurl:AddFunction("getFileDetails", oSetupCommand:GetAsString())
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
// Register getEnterprise; registration sends no request.
oSetupCommand:SetString('curl -X GET "https://api.box.com/2.0/users/me?fields=enterprise" -H "Authorization: Bearer ACCESS_TOKEN"')
nSetupReplacements := oSetupCommand:Replace("ACCESS_TOKEN", oCurl:GetVar("access_token"))
nSuccess := oCurl:AddFunction("getEnterprise", oSetupCommand:GetAsString())
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
// Register output rules once. Chilkat 11.7.0 evaluates {{name}} variables
// when extracting each output, using the current value at that time.
nSuccess := oCurl:AddOutput2("findParent", "entries", "name", "{{parent_name}}", 1, "id", "parent_id")
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
nSuccess := oCurl:AddOutput2("findFolder", "entries", "name", "{{folder_name}}", 1, "id", "folder_id")
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
nSuccess := oCurl:AddOutput2("findFile", "entries", "name", "{{file_name}}", 1, "id", "file_id")
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
nSuccess := oCurl:AddOutput2("findDestination", "entries", "name", "{{destination_name}}", 1, "id", "destination_id")
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
nSuccess := oCurl:AddOutput("getFileDetails", "file_version.id", "file_version_id")
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
nSuccess := oCurl:AddOutput("getFileDetails", "sha1", "file_sha1")
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
nSuccess := oCurl:AddOutput("getEnterprise", "enterprise.id", "enterprise_id")
IF (nSuccess != 1)
? oCurl:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
RETURN
ENDIF
// END ONE-TIME SETUP
// The name lookups below assume each listing fits in one page (1000 items).
// Parent and destination names select root children; folder_name selects a child
// of parent_name. "/" selects the root parent. These are not arbitrary paths.
// BEGIN OPERATION -- keep the configured object when reusing it.
// Inputs are names. Retain cached IDs when the selected names have not changed.
cParentName := "/"
cFolderName := "documents"
IF ((oCurl:GetVar("parent_name") != cParentName) .OR. ((cParentName == "/") .AND. (oCurl:VarDefined("parent_id") == 0)))
oCurl:SetVar("parent_name", cParentName)
oCurl:ClearVar("parent_id")
oCurl:ClearVar("folder_id")
oCurl:ClearVar("file_id")
oCurl:ClearVar("file_version_id")
oCurl:ClearVar("file_sha1")
IF (cParentName == "/")
oCurl:SetVar("parent_id", "0")
ENDIF
ENDIF
IF (oCurl:GetVar("folder_name") != cFolderName)
oCurl:SetVar("folder_name", cFolderName)
oCurl:ClearVar("folder_id")
oCurl:ClearVar("file_id")
oCurl:ClearVar("file_version_id")
oCurl:ClearVar("file_sha1")
ENDIF
// Resolve the named destination first. HttpCurl does not expand variables
// inside multipart -F attributes in the tested build, so this upload is two phases.
oCurl:ClearTargetOutput("*")
oAuthorizedCommand1 := CreateObject("Chilkat.StringBuilder")
oAuthorizedCommand1:SetString('curl -X GET "https://api.box.com/2.0/folders/{{folder_id}}?fields=id" -H "Authorization: Bearer {{access_token}}"')
nHeaderReplacement1 := oAuthorizedCommand1:Replace("{{access_token}}", oCurl:GetVar("access_token"))
nSuccess := oCurl:DoYourThing(oAuthorizedCommand1:GetAsString())
IF ((nSuccess != 1) .OR. (oCurl:StatusCode != 200))
? "Box request failed. HTTP status: " + Str(oCurl:StatusCode)
? "Failure reason: " + Str(oCurl:FailReason)
? oCurl:ResponseBodyStr
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
RETURN
ENDIF
// This example limits size to 2 GB so offsets fit all generated languages' integers.
// The source must not change during hashing or upload. Create qa_output first.
cLocalPath := "qa_data/large-document.zip"
oFile := CreateObject("Chilkat.FileAccess")
// Check the decimal size before converting so an oversized file cannot overflow int.
cSizeString := oFile:FileSizeStr(cLocalPath)
IF (oFile:LastMethodSuccess != 1)
? oFile:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
RETURN
ENDIF
oSizeText := CreateObject("Chilkat.StringBuilder")
oSizeText:SetString(cSizeString)
oSizeMatch := CreateObject("Chilkat.JsonObject")
IF (oSizeText:RegexMatch("^([0-9]{1,9}|1[0-9]{9}|2000000000)$", oSizeMatch, 100) != 1)
? "Choose an input between 20 MB and 2 GB for this example."
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
RETURN
ENDIF
nFileSize := Val(cSizeString)
IF (nFileSize < 20971520)
? "Choose an input between 20 MB and 2 GB for this example."
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
RETURN
ENDIF
oHttp := CreateObject("Chilkat.Http")
oHttp:AuthToken := oCurl:GetVar("access_token")
oResponse := CreateObject("Chilkat.HttpResponse")
oRequest := CreateObject("Chilkat.JsonObject")
oRequest:UpdateString("folder_id", oCurl:GetVar("folder_id"))
oRequest:UpdateString("file_name", "large-document.zip")
oRequest:UpdateInt("file_size", nFileSize)
nSuccess := oHttp:HttpJson("POST", "https://upload.box.com/api/2.0/files/upload_sessions", oRequest, "application/json", oResponse)
IF (nSuccess != 1)
? oHttp:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
RETURN
ENDIF
IF (oResponse:StatusCode != 201)
? oResponse:BodyStr
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
RETURN
ENDIF
oSession := CreateObject("Chilkat.JsonObject")
nSuccess := oSession:Load(oResponse:BodyStr)
IF (nSuccess != 1)
? oSession:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
RETURN
ENDIF
nSuccess := oSession:WriteFile("qa_output/box_upload_session.json")
IF (nSuccess != 1)
? oSession:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
RETURN
ENDIF
nPartSize := oSession:IntOf("part_size")
cUploadUrl := oSession:StringOf("session_endpoints.upload_part")
cCommitUrl := oSession:StringOf("session_endpoints.commit")
IF ((nPartSize <= 0) .OR. (cUploadUrl == "") .OR. (cCommitUrl == ""))
? "Invalid session response."
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
RETURN
ENDIF
oHash := CreateObject("Chilkat.Crypt2")
oHash:HashAlgorithm := "sha1"
oHash:EncodingMode := "base64"
cFileDigest := oHash:HashFileENC(cLocalPath)
IF (oHash:LastMethodSuccess != 1)
? oHash:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
RETURN
ENDIF
nSuccess := oFile:FileOpen(cLocalPath, 2147483648, 1, 3, 0)
IF (nSuccess != 1)
? oFile:LastErrorText
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
RETURN
ENDIF
oCommit := CreateObject("Chilkat.JsonObject")
oPartResponse := CreateObject("Chilkat.JsonObject")
oChunk := CreateObject("Chilkat.BinData")
oRange := CreateObject("Chilkat.StringBuilder")
oDigestHeader := CreateObject("Chilkat.StringBuilder")
nOffset := 0
nPartIndex := 0
DO WHILE nOffset < nFileSize
oChunk:Clear()
nSuccess := oFile:FileReadBd(nPartSize, oChunk)
IF (nSuccess != 1)
? oFile:LastErrorText
oFile:FileClose()
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
RETURN
ENDIF
nPartLength := oChunk:NumBytes
IF (nPartLength <= 0)
? "Unexpected end of file."
oFile:FileClose()
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
RETURN
ENDIF
nLastByte := nOffset + (nPartLength - 1)
oRange:Clear()
oRange:Append("bytes ")
oRange:AppendInt(nOffset)
oRange:Append("-")
oRange:AppendInt(nLastByte)
oRange:Append("/")
oRange:AppendInt(nFileSize)
cPartDigest := oHash:HashBdENC(oChunk)
IF (oHash:LastMethodSuccess != 1)
? oHash:LastErrorText
oFile:FileClose()
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
RETURN
ENDIF
oDigestHeader:SetString("sha=")
oDigestHeader:Append(cPartDigest)
oHttp:SetRequestHeader("Digest", oDigestHeader:GetAsString())
oHttp:SetRequestHeader("Content-Range", oRange:GetAsString())
nSuccess := oHttp:HttpBd("PUT", cUploadUrl, oChunk, "application/octet-stream", oResponse)
IF ((nSuccess != 1) .OR. (oResponse:StatusCode != 200))
? "Part failed. HTTP status: " + Str(oResponse:StatusCode)
? oResponse:BodyStr
? "Inspect the saved session and server list_parts before retrying this part."
oFile:FileClose()
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
RETURN
ENDIF
nSuccess := oPartResponse:Load(oResponse:BodyStr)
IF (nSuccess != 1)
oFile:FileClose()
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
RETURN
ENDIF
oCommit:I := nPartIndex
// Copy the server's acknowledged part fields into the commit manifest.
oCommit:UpdateString("parts[i].part_id", oPartResponse:StringOf("part.part_id"))
oCommit:UpdateInt("parts[i].offset", oPartResponse:IntOf("part.offset"))
oCommit:UpdateInt("parts[i].size", oPartResponse:IntOf("part.size"))
oCommit:UpdateString("parts[i].sha1", oPartResponse:StringOf("part.sha1"))
nSuccess := oCommit:WriteFile("qa_output/box_upload_parts.json")
IF (nSuccess != 1)
? oCommit:LastErrorText
oFile:FileClose()
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
RETURN
ENDIF
nOffset := nOffset + nPartLength
nPartIndex := nPartIndex + 1
ENDDO
oFile:FileClose()
oHttp:RemoveRequestHeader("Content-Range")
oDigestHeader:SetString("sha=")
oDigestHeader:Append(cFileDigest)
oHttp:SetRequestHeader("Digest", oDigestHeader:GetAsString())
nAttempts := 0
oRetryHeader := CreateObject("Chilkat.StringBuilder")
oRetryMatch := CreateObject("Chilkat.JsonObject")
nCompleted := 0
DO WHILE (nAttempts < 10) .AND. (nCompleted == 0)
nSuccess := oHttp:HttpJson("POST", cCommitUrl, oCommit, "application/json", oResponse)
IF (nSuccess != 1)
? "Commit failed: " + Str(oResponse:StatusCode)
? oResponse:BodyStr
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
oRetryHeader:destroy()
oRetryMatch:destroy()
RETURN
ENDIF
IF (oResponse:StatusCode == 201)
nCompleted := 1
ELSE
IF (oResponse:StatusCode != 202)
? "Unexpected commit status: " + Str(oResponse:StatusCode)
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
oRetryHeader:destroy()
oRetryMatch:destroy()
RETURN
ENDIF
// Box's asynchronous commit response supplies Retry-After in seconds.
oRetryHeader:SetString(oResponse:GetHeaderField("Retry-After"))
IF (oRetryHeader:RegexMatch("^[0-9]{1,2}$", oRetryMatch, 100) != 1)
? "Commit pending. Preserve the session and inspect Retry-After before resuming: " + oRetryHeader:GetAsString()
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
oRetryHeader:destroy()
oRetryMatch:destroy()
RETURN
ENDIF
nWaitSeconds := Val(oRetryHeader:GetAsString())
IF ((nWaitSeconds < 1) .OR. (nWaitSeconds > 60))
? "Commit pending. Resume commit after Retry-After: " + oResponse:GetHeaderField("Retry-After")
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
oRetryHeader:destroy()
oRetryMatch:destroy()
RETURN
ENDIF
oHttp:SleepMs(nWaitSeconds * 1000)
ENDIF
nAttempts := nAttempts + 1
ENDDO
IF (nCompleted == 0)
? "Commit still pending; retain session and part manifests to resume commit later."
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
oRetryHeader:destroy()
oRetryMatch:destroy()
RETURN
ENDIF
? "Upload committed: " + oResponse:BodyStr
oCurl:destroy()
oSetupCommand:destroy()
oAuthorizedCommand1:destroy()
oFile:destroy()
oSizeText:destroy()
oSizeMatch:destroy()
oHttp:destroy()
oResponse:destroy()
oRequest:destroy()
oSession:destroy()
oHash:destroy()
oCommit:destroy()
oPartResponse:destroy()
oChunk:destroy()
oRange:destroy()
oDigestHeader:destroy()
oRetryHeader:destroy()
oRetryMatch:destroy()