Use the Internet Transfer Control.
Subroutine AddMessage simply displays status messages to keep you informed of what's happening.
When you click the Download button, cmdDownload_Click sets the control's URL, UserName, and Password properties in that order. It then calls the control's Execute method passing it the command name Get, the name of the remote file, and the local file where it should be downloaded.
When you click Upload, the programagain sets the control's URL, UserName, and Password properties in that order. It then calls the control's Execute method passing it the command name Put, the name of the local file, and the location on the server where the file should be placed.
The control's StateChanged event handler displays a message telling you what's happening. The most interesting case is when the routine reads the icResponseCompleted condition. If the control is downloading a directory listing, the program uses the control's GetChunk method to read the listing in pieces.
|