I need help with the code below. I am running it through a Windows app that executes the script within itself. It works fine for files up to 149 MB. After it errors out with
Provider: Not enough storage is available to complete this operation.
I have tried researching this but found no suitable answers so far. Does anyone have any ideas on how to overcome this error or is this a Windows environment limitation? If so, is there a way to go around? I need to be able to upload up to 3GB file size.
Code:
Option Explicit
' Declare variables
Dim request, HTTPPost, oHTTP, postURL, inStream, bytData, bytPayLoad
Dim inFile, AccessToken, strBoundary, jobID, tFLOW_JSON
Const TypeBinary = 1
Const ForReading = 1, ForWriting = 2, ForAppending = 8
' Setup variable
AccessToken = "abgdket567jjjhd8kk"
jobID = "16788"
tFLOW_JOSN = "First_Upload"
inFile = "D:\e_Brain\AUTOMATION\tFLOW\API\ORDER\CREATED\FILE_IN\" + jobID + ".pdf"
strBoundary = "------WebKitFormBoundary7MA4YWxkTrZu0gW"
' Read Incoming File as Binary
With CreateObject("ADODB.Stream")
.Type = 1
.Mode = 3
.Open
.LoadFromFile inFile
bytData = .Read '->This is where it errors out
End With
' Setup BODY data
With CreateObject("ADODB.Stream")
.Mode = 3
.Charset = "Windows-1252"
.Open
.Type = 2
.WriteText "--" & strBoundary & vbCrLf
.WriteText "Content-Disposition: form-data; name=""artwork""; filename=""" & inFile & """" & vbCrLf
.WriteText "Content-Type: application/pdf" & vbCrLf & vbCrLf
.Position = 0
.Type = 1
.Position = .Size
.Write bytData
.Position = 0
.Type = 2
.Position = .Size
.WriteText vbCrLf & "--" & strBoundary & "--"
.Position = 0
.Type = 1
bytPayLoad = .Read
End With
' POST FILE
postURL = "https://linemark.tflowproof.com/api/v2/job/" + jobID + "/executeTransition?_json={""transition_name"":""" + tFLOW_JSON + """}"
With CreateObject("MSXML2.ServerXMLHTTP")
.SetTimeouts 0, 60000, 300000, 300000
.Open "POST", postURL, False
.SetRequestHeader "Content-type", "multipart/form-data; boundary=" & strBoundary
.SetRequestHeader "Authorization", "" + AccessToken + ""
.Send bytPayLoad
End With