Article View: borland.public.cppbuilder.internet.socket
Article #4FTP file download for Indy 9
From: ANTHONY WEST
Date: Thu, 17 Jul 2008 07:39
Date: Thu, 17 Jul 2008 07:39
84 lines
3828 bytes
3828 bytes
I am using Borland builder 4 standard. I have downloaded
Indy 9 source code that I am attempting to figure out how to use,
but I do not have a clue on how to begin. My goal is to download a
file from my ftp site using a username and password. The main
purpose is to have my app check for updates and download
them if available. I am already using code to download a version
information file via HTTP.
This is what is left that needs to be done:
- log in to my FTP site using name and password
- download the file while showing the download progress
I have googled all day for C++ code on how to do this. No
luck.
Here is my source code so far:
void __fastcall TImageForm::UpdatesBtnClick(TObject *Sender)
{
int latestVersion, i;
AnsiString fileName, updateLink, thisVersion;
ifstream in;
Screen->Cursor = crAppStart;
ShowStatusBarMessage("Connecting to update server...");
updateLink =
"http://www.aswsoftware.com/products/bibleart/currentVersion.upd";
fileName = MainMenuForm->DirLbl->Caption + "LatestVersion.upd";
if(URLDownloadToFile(0,updateLink.c_str(), fileName.c_str(),0,0))
{
MessageDlg("Unable to connect to update server. Please make\nsure "
"that you are connected to the internet and\n try "
"again. If you are connected to the internet, then\n"
"the update server is not responding. Please visit\n"
"www.aswsoftware.com\nto manually check for the latest "
"version.", mtError, TMsgDlgButtons() << mbOK, 0);
ShowStatusBarMessage("Failed to obtain update information.");
}
else
{
ShowStatusBarMessage("Getting latest version information from
server...");
in.open(fileName.c_str());
if (in.fail())
{
MessageDlg("Error obtaining update information.", mtError,
TMsgDlgButtons() << mbOK, 0);
}
else
{
in >> latestVersion;
in.close();
thisVersion = MainMenuForm->VersionLbl->Caption;
for (i = 1; i <= thisVersion.Length(); i++)
{
if (thisVersion[i] == '.')
thisVersion.Delete(i, 1);
}
if (thisVersion.ToInt() >= latestVersion)
{
ShowStatusBarMessage("No updates are available at this time.");
ShowMessage ("There is not an update available at this time.");
}
else
{
ShowStatusBarMessage("Downloading update.");
// This is where I need FTP code
ShowMessage ("Update Downloaded.");
}
}
}
Screen->Cursor = crDefault;
}
--
Anthony West
<-- What a great day to be alive :) -->
Technical Details
Message-ID:
<487ef727$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!proxad.net!feeder1-2.proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,46736b455fe961ab,start X-Google-Attributes: gid11508e,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "ANTHONY WEST" <teroni@email.uophx.edu> Newsgroups: borland.public.cppbuilder.internet.socket Subject: FTP file download for Indy 9 Date: Thu, 17 Jul 2008 00:39:31 -0700 Lines: 86 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Antivirus: avast! (VPS 080717-0, 07/17/2008), Outbound message X-Antivirus-Status: Clean NNTP-Posting-Host: 72.208.250.215 Message-ID: <487ef727$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1216280359 72.208.250.215 (17 Jul 2008 00:39:19 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!proxad.net!feeder1-2.proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail