I'm developing an application which will transfer binary files between a VB client and the web. It works at the moment courtesy of me having developed a basic FTP client which communicates with an FTP server (via a Winsock control) and transfers files using RETR and STOR commands. The application also communicates with a Perl interface to MySQL via HTTP.
I can't help feeling that life would be simpler if I handled the file transfers using HTTP. FTP requires a log in, changing directories, PORT commands, keeping the session alive and more (all of which may or may not succeed and as such have to be handled when they don't) whereas HTTP seems far simpler - GET and PUT/POST - which I figure would either work or not.
GETting a file is easy. I wouldn't be typing this question if that's all I wanted to do. I also want to PUT files, but I understand that servers may be configured to not allow this. So what are my options?
The POST command looks like a suitable candidate, but sadly my knowledge of HTTP/CGI/Perl is not sufficient for me to know HOW I could use it. My thoughts are to build a request on the client which consists of the appropriate headers and a long stream of binary data (potentially several megabytes worth) which constitute the file. The server-side script would then turn that back into a file.
I've seen Perl which claims to do this, but involves the use of a form at the client end. Remember that I'm trying to do this by building a request in a VB client and sending it through a Winsock control. abel's code here, for example : http://www.experts-exchange.com/questions/Q_10292336.html
works fine if I create the form he suggests.
Any ideas how I can do it without the form?