VBScript上传大文件错误:没有足够的存储空间来完成此操作

时间:2019-01-22 15:17:57

标签: post vbscript adodb windows-server-2012-r2

我需要以下代码的帮助。我正在通过Windows应用程序运行它,该应用程序在其内部执行脚本。它适用于最大149 MB的文件。错误出现后

  

提供者:没有足够的存储空间来完成此操作。

我已尝试对此进行研究,但到目前为止没有找到合适的答案。是否有人对如何克服此错误有任何想法?这是Windows环境的限制吗?如果是这样,有没有办法解决?我需要能够上传最大3GB的文件。

代码:

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

0 个答案:

没有答案