Click here to Skip to main content
15,887,214 members
Articles / Desktop Programming / MFC
Article

CFTPTransferDlg v1.0 - The FTP Protocol

Rate me:
Please Sign up or sign in to vote.
4.44/5 (8 votes)
3 Mar 2000 157.8K   3K   47   34
A dialog implementation that performs a FTP file transfer.
  • Download source files - 42 Kb
  • Sample Image - FTPTransferDlg.gif

    Introduction

    CFTPTransgerDlg provides an MFC dialog which performs FTP uploads and downloads similar to the Internet Explorer download dialog as shown above.


    History
    Usage
    Contacting the Author


    History

    v1.0 (4 January 2000)
    • Initial public release.


    Usage

    To use CFTPTransferDlg in your project simply include FTPTransferDlg.cpp/.h from the test application in your application and #include "FTPTransferDlg.h" in whichever files you want to use the class in. You should also copy over all the IDS_FTPTRANSFER_.. string resources, the IDD_FTPTRANSFER dialog resource and the IDR_FTPTRANSFER_ANIMATION "avi" resource. To bring up the dialog to upload / download a specific file, just use some code like the following:

    CFTPTransferDlg dlg;
    dlg.m_sServer = _T("ftp.some-site.com");
    dlg.m_sRemoteFile = _T("/somefile.ext");
    dlg.m_sLocal = _T("c:\\somfile.ext");
    dlg.m_bDownload = TRUE;
    dlg.m_bBinary = TRUE;
    if (dlg.DoModal() == IDOK)
       AfxMessageBox("File was downloaded successfully");

    You should also have a look at the CFTPDlg::OnDownload() and CFTPDlg::OnUpload() code in the sample application.


    Contacting the Author

    PJ Naughter
    Email: pjn@indigo..ie
    Web: http://www.naughter.com
    4th January 2000


    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    United States United States
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    QuestionLicence?? Pin
    pippo pioppo8-Dec-11 23:49
    pippo pioppo8-Dec-11 23:49 
    GeneralVirus FakeIE_i Pin
    johnTorresBarreto9-Jun-11 9:29
    johnTorresBarreto9-Jun-11 9:29 
    QuestionWould it be better if the ftp upload would have been independednt of the GUI ? Pin
    Vikrant for VC++15-Nov-06 11:56
    Vikrant for VC++15-Nov-06 11:56 
    AnswerRe: Would it be better if the ftp upload would have been independednt of the GUI ? Pin
    pjnaughter3-May-07 13:26
    pjnaughter3-May-07 13:26 
    Generalprotocol implementation Pin
    raian_blore6-Dec-05 19:53
    raian_blore6-Dec-05 19:53 
    Generalhelp , please Pin
    dynamica12316-Oct-05 4:07
    dynamica12316-Oct-05 4:07 
    GeneralRe: help , please Pin
    Colby50025-Jul-06 4:03
    Colby50025-Jul-06 4:03 
    GeneralUploading images Pin
    Jack_pt16-Jan-05 15:39
    Jack_pt16-Jan-05 15:39 
    GeneralRe: Uploading images Pin
    Tomas Jakl19-Jan-05 14:35
    Tomas Jakl19-Jan-05 14:35 
    GeneralText is one long line Pin
    Jack_pt11-Dec-04 15:37
    Jack_pt11-Dec-04 15:37 
    GeneralMissing feature: Multiple file transfer Pin
    YoSilver1-May-04 8:46
    YoSilver1-May-04 8:46 
    GeneralRe: Missing feature: Multiple file transfer Pin
    pjnaughter1-May-04 11:21
    pjnaughter1-May-04 11:21 
    GeneralRe: Missing feature: Multiple file transfer Pin
    pjnaughter9-May-04 4:36
    pjnaughter9-May-04 4:36 
    GeneralRe: Missing feature: Multiple file transfer Pin
    Jack_pt27-Nov-04 15:16
    Jack_pt27-Nov-04 15:16 
    GeneralRe: Missing feature: Multiple file transfer Pin
    Jack_pt15-Dec-04 10:33
    Jack_pt15-Dec-04 10:33 
    GeneralSecurity Issue Pin
    alan9320-Nov-03 4:10
    alan9320-Nov-03 4:10 
    GeneralRe: Security Issue Pin
    pjnaughter20-Nov-03 4:55
    pjnaughter20-Nov-03 4:55 
    Couple of things:

    1) What dialog are you talking about. In the sample app I provide a dialog for filling in the values for testing purpoes but in a real program you would not require this.

    2) If you are hardcoding these values into your program, then the same issues apply to these values as they would to any other type of password / secure information which you want to embed into your code.

    This is an age old problem and there are a number of articles on codeproject on this. You can go from something like modulo arithmetic to simple XOR masks to more complicated but secure private key encryption mechanisms, but the problem will remain of having a password variable lying around in your address space for some time. You can get quite advanced on this by putting in anti debugging envelopes into your program (as used by dongle protection software) but in the end this will just mean that it will take a hacker 10 hours instead of 5 hours to crack<gg>. I will produce an update to the class sometime soon to ensure that the username and password are only kept in memory for as short as possible.

    Regards,
    GeneralRe: Security Issue Pin
    alan9320-Nov-03 5:51
    alan9320-Nov-03 5:51 
    Generalneed help:FTP Pin
    girishnadig29-Aug-03 1:17
    girishnadig29-Aug-03 1:17 
    GeneralIt is too slow compared to ordinary downloading Pin
    11-Jun-02 18:53
    suss11-Jun-02 18:53 
    GeneralRe: It is too slow compared to ordinary downloading Pin
    pjnaughter22-Jan-03 0:26
    pjnaughter22-Jan-03 0:26 
    GeneralIs it work on proxy Pin
    4-May-02 2:36
    suss4-May-02 2:36 
    GeneralRe: Is it work on proxy Pin
    pjnaughter22-Jan-03 0:28
    pjnaughter22-Jan-03 0:28 
    Generalftp command Pin
    Paul Pang17-Mar-02 20:16
    Paul Pang17-Mar-02 20:16 
    GeneralRe: ftp command Pin
    pjnaughter22-Jan-03 0:29
    pjnaughter22-Jan-03 0:29 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.