Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1522

how can use winsock or xml or other way for upload file field+strings.then get json

$
0
0
hi
i hv a html like this:

Code:

        <form method="POST" action="destionation" enctype="multipart/form-data">
            <label>
                <span>chat_id :</span>
                <input id="field1" type="text" name="chat_id" value="11" />
            </label>
            <label>
                <span>caption :</span>
                <input id="field2" type="text" name="caption"/>
            </label>
            <label>
                <span>photo</span>
                <input id="photo" type="file" name="photo" />
            </label>     
            <label>
                <span>&nbsp;</span>
                <input id="send" type="submit" class="button" value="senddata" />
            </label>   
        </form>

i always use web browser for post these data but i hv problem like : (downlod json dialoge result after posted or i can not get event completed)

now i want use other way to can get result and events too like json reulst after post or event for complete after result retunred.


i hv sample with xml or winsock like this :

Code:

sEntityBody = "----boundary" & vbCrLf
sEntityBody = sEntityBody & "Content-Disposition: form-data; name=fileInputElementName; filename=""" + sFileName + """" & vbCrLf
sEntityBody = sEntityBody & "Content-Transfer-Encoding: base64" & vbCrLf
sEntityBody = sEntityBody & "Content-Type: application/pdf" &  vbCrLf & vbCrLf
sEntityBody = sEntityBody & sPDFBase64 & vbCrLf
sEntityBody = sEntityBody & "-----boundary--" & vbCrLf & vbCrLf

Set xhr = New MSXML2.XMLHTTP30
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=-----boundary")
xhr.Open "POST", sUrl, False
xhr.send sEntityBody

but not worked .

any body here can help me to can post both strings and file fields?

Viewing all articles
Browse latest Browse all 1522

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>