Hallo!
Ich verwende folgenden Code um ein POST Formular mit einer Datei abzuschicken.
Es kann aber sein, dass die Seite nicht erreichbar ist bzw. ich kein Ergebnis erhalte.
Daher wollte ich fragen, wie ich dies prüfen kann um dann den Vorgang abzubrechen.
Vielen Dank für jede Antwort.

HTML Code:
Private Function pvPostFile_werte2(sUrl As String, sFilename As String, Optional ByVal bAsync As Boolean) As String
    Const STR_BOUNDARY  As String = "3fbd04f5-b1ed-4060-99b9-fca7ff59c113"
    Dim nFile           As Integer
    Dim baBuffer()      As Byte
    Dim sPostData       As String
     Dim initdisplay As Integer
    Dim pfad As String
    Dim response As String

    On Error GoTo err
    
    '--- read file
    nFile = FreeFile
    Open sFilename For Binary Access Read As nFile
    If LOF(nFile) > 0 Then
        ReDim baBuffer(0 To LOF(nFile) - 1) As Byte
        Get nFile, , baBuffer
        sPostData = StrConv(baBuffer, vbUnicode)
    End If
    Close nFile
   
     
    '--- prepare body
     sPostData = "--" & STR_BOUNDARY & vbCrLf & _
        "Content-Disposition: form-data; name=""file_input""; filename=""" & Mid$(sFilename, InStrRev(sFilename, "\") + 1) & """" & vbCrLf & _
        "Content-Type: application/octet-stream" & vbCrLf & vbCrLf & _
        sPostData & vbCrLf & _
        "--" & STR_BOUNDARY & "--"
        '--- post
        
    With CreateObject("Microsoft.XMLHTTP")
        .Open "POST", sUrl, bAsync
        .SetRequestHeader "Content-Type", "multipart/form-data; boundary=" & STR_BOUNDARY
        .Send pvToByteArray(sPostData)
        response = .responsetext
        
       
    End With

End Function