October 25th, 2002, 04:04 AM
Http file upload (Post)
Does anyone know how to upload a file and form data
to a server?
What i want to do is allow a user to upload a file and form data
to my php script so i can process it. So of course FTP would be
I can do this with the XMLHTTP control but it does not thread and
it pretty lame. Surely you can do it with winsock or Inet
Source code would be greatly appreciated.
Comments on this post
October 25th, 2002, 02:20 PM
Just a stupid question from me, but why not just have the user access the php page through a browser?
Another possible solution would be to use sockets but I have no code for you on that, the MSDN library might have some examples for you though.
October 25th, 2002, 10:29 PM
re: Http File uload (Post)
Sorry forgot to mention, i have a VB program that the user uses and then they submit the info to the server. (a file and form fields)
Here is the URL for the XMLHTTP method
Comments on this post
October 26th, 2002, 03:01 AM
Try using the Webbrowser control from Microsoft Internet Controls to do your stuff. That's what I usually use, with code something like this:
If you want to use a GET method instead of POST, then simply remove the extra params from the call and use WebBrowser.Navigate sURL or WebBrowser.Navigate2 sURL instead. I just put the above code together off the top of my head and haven't checked it to see if it actually works, but the syntax should be pretty close.
Dim bPostData() As Byte
Dim sHeaders As String
sPost = "foo=1&bar=test&quux=42" ' Post data
sHeaders = "Content-Type: application/x-www-form-urlencoded" & vbCrlf ' Add extra headers as needed
bPost = StrConv(sData, vbFromUnicode)
WebBrowser.Navigate sURL, 0, vbEmpty, bPostData, sHeaders
WebBrowser.Navigate2 sURL, 0, vbEmpty, bPostData, sHeaders
Hope this helps!
Last edited by Scorpions4ever; October 26th, 2002 at 03:05 AM.
October 26th, 2002, 07:43 PM
That method only works with Text files.
Klemens Schmid has some source on how to send a text file
using that method.
It works great but i get a weird error every second time i send
to the server.
The error is this:
Method Not Implemented
--AaB03x to / not supported.
Invalid method in request --AaB03x
The server is running Apache 1.3.26 (a freebie server)
Any ideas why it does this?