VFP FTP File Transfer

Posted on 2012-09-10
Last Modified: 2012-09-11
Hi all. I'm looking to transfer files to and from an FTP server.
I know this isn't a simple task in FP and I think I've researched and looked at just about every available option there is.

So far I haven't been able to find anything the 1) actually works in my tests, or 2) that I would know how to implement.

So I was wondering if anyone here has some suggestions of things they've tried and used.
Question by:formadmirer
    LVL 6

    Expert Comment

    Files can be transferred between a pair of machines with FTP.

    There are a number of parameters that are necessary to know when connecting to an FTP server.

    FTP server name or IP address
    Port number

    There are three basic ways to communicate with an FTP server.
    Use a web browser as your FTP client
    Use the command-prompt FTP client
    Use a graphical FTP client

    For more details and step by step solution, refer below article:
    LVL 27

    Expert Comment

    I used these to download FTP and HTTP files:

    DECLARE INTEGER InternetOpen IN wininet.DLL STRING sAgent, INTEGER lAccessType, STRING sProxyName, STRING sProxyBypass, INTEGER lFlags
    DECLARE INTEGER InternetConnect IN wininet.DLL INTEGER hInternetSession, STRING cServerName, INTEGER nServerPort, STRING cUserName, STRING cPassword, INTEGER nService, INTEGER nFlags, INTEGER nContext
    DECLARE INTEGER InternetSetOption IN wininet.DLL INTEGER hInternet, INTEGER nOption, STRING @lpBuffer, LONG nBufferLength
    DECLARE INTEGER InternetOpenUrl IN wininet.DLL INTEGER hInternetSession, STRING sUrl, STRING sHeaders, INTEGER lHeadersLength, INTEGER lFlags, INTEGER lContext
    DECLARE INTEGER InternetReadFile IN wininet.DLL INTEGER hfile, STRING @sBuffer, INTEGER lNumberofBytesToRead, INTEGER @lBytesRead
    DECLARE SHORT InternetCloseHandle IN wininet.DLL INTEGER hInst

    Open in new window

    LVL 27

    Expert Comment

    LVL 29

    Accepted Solution

    specifically for VFP


    libcurl (FTP, FTPS besides others):

    You can even use DOS FTP or the Microsoft Internet Transfer ActiveX Control, which besides others comes with VFP and can be redistributed.

    Bye, Olaf.
    LVL 3

    Expert Comment

    I have been using VFPConnection.fll that Olaf suggested above for years without issue.  Lots of sample code and very easy to use.  I would highly recommend.
    LVL 27

    Expert Comment

    I have heard of many users happily using tools from:

    I never tried them though. I always write my own code.
    LVL 12

    Expert Comment

    For years I have been successfully using FTPPut and FTPGet with my client's VFP applications

    Admittedly, when I first started working with these I had to communicate with technical support on the 'other' end to get all of the parameters correct - such as TargetDir, FileType (Binary or ASCII), Target Directory slashs (forward or backward), Port (default - 21 for FTP or 22 for SFTP), etc.  

    But once the configuration was correctly established, things have run consistently well.

    I'd suggest this route since it was pretty simple to do.

    Good Luck

    Author Comment

    Of the solutions I've looked at suggested here and elsewhere I think I like VFPConnection.fll the best. As soon as I get the time I am going to see just what it will take to implement it.

    As for FTPPut and FTPGet, I am not familiar with them but I am assuming they are similiar to Wget and Wput which I have been using for a while now without issue. Ok, maybe one.

    Actually, while I'm thinking about it I will post another question addressing suppressing the command window popup with Wput/get since that will be a big issue here shortly that I will need to address.

    Many thanks to all who replied.
    LVL 29

    Expert Comment

    by:Olaf Doschke
    Wget does offer a lot more than just simple ftp or http get,put etc. It allows retry, recursive requests and more. So it is a nice tool, but you can replace it, if you just get ftp or http URLs anyway, and that would help lower the number of components used, the complexity and give a better maintainability. So if that wget window annoys you, and you don't use it's advanced features, then go for VFPConnection.fll, yes, it offers all the simple types of requests.

    Bye, Olaf.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: (http://msd…
    Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now