Access 2010 データベースで vba/XMLHTTP を使用してファイルをアップロードしようとしています。処理中ですが、エラーは発生しませんが、私の Web サイトには何も表示されません。
を使用して呼び出されるコードは次のとおりです。
response = HTTP_FileUpload(ShowName, "www.website_name","POST")
Public Function HTTP_FileUpload(FileName As String, ByVal pUrl As String, _
Optional ByVal pMethod As String = "GET") As String
Dim strResponse As String
On Error GoTo ErrorHandler
Dim xmlStream As Object
Set xmlStream = CreateObject("ADODB.Stream")
xmlStream.Mode = 3 ' //read write
xmlStream.Type = adTypeBinary
xmlStream.Open
xmlStream.LoadFromFile FileName
Dim objHttp As Object
Set objHttp = CreateObject("MSXML2.XMLHTTP")
objHttp.Open pMethod, pUrl, False
Debug.Print "file Name is " & FileName & " Size of file is " & xmlStream.Size
objHttp.setRequestHeader "Content-Type", "text/generic"
objHttp.setRequestHeader "Content-Length", xmlStream.Size
objHttp.send
strResponse = objHttp.responseText
HTTP_FileUpload = strResponse
Set objHttp = Nothing
Exit Function
ErrorHandler:
MsgBox "Error - code is " & Err.Number & " - " & Err.Description
End Function