Uploading a file via FTP is almost exactly the same as the way I used HTTP objects earlier - I call CInternetSessions' GetFtpConnection method:// now upload file to my website
if ( !AfxParseURL ( sSendToURL, dwServiceType, sServerName, sObject, nPort ) )
throw;
// open FTP connection
pFTPServer = csiSession.GetFtpConnection ( sServerName, _T( "username" ), _T( "password" ), nPort );
// change to utils folder
pFTPServer->SetCurrentDirectory ( _T( "utils" ) );
// put the new file in the folder
pFTPServer->PutFile ( sNewsFile, sNewsFile );
| When run, the application finally displays the page on my website where the news is displayed, so I can check it all worked correctly. You can get the full source code below.Writing this code is an excellent way to introduce yourself to MFC's internet objects. Remember that these are all available to use just as easily from a COM component too. Have fun!  |