如何发布通过HTTP POST文件在vb.net文件、POST、HTTP、vb

2023-09-02 10:30:47 作者:撒谎的哈桑℅

有通过HTTP发布在vb.net中发送一个文件有问题。我试图模仿下面的HTML所以vb.net做同样的事情。

Having a problem with sending a file via HTTP post in vb.net. I am trying to mimic the following HTML so the vb.net does the same thing.

<form enctype="multipart/form-data" method="post" action="/cgi-bin/upload.cgi">
File to Upload:
<input type="file" name="filename"/>
<input type="submit" value="Upload" name="Submit"/>
</form>

希望有人能帮助!

Hope someone can help!

推荐答案

我想你问的是什么来发布文件,从VB.Net WinForms应用程序的Web服务器的CGI脚本的能力。

I think what you are asking for is the ability to post a file to a web server cgi script from a VB.Net Winforms App.

如果是这样的话,这应该为你工作。

If this is so this should work for you

Using wc As New System.Net.WebClient()
    wc.UploadFile("http://yourserver/cgi-bin/upload.cgi", "c:test.bin")
End Using