The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Uploading files to a web site in a Windows app?


User uses my little shareware application, which generates some HTML files, that he wants to put on his web site.


What's the best way to get the files to the site?

1. Output the files in a folder, and let the user upload them himself

2. Add an FTP function to my app, by coding it myself

3. Add an FTP function to my app, by using some component (n.b. must be royalty free) or source code library

4. Use the WpPost/WpPostEx APIs

5. Other?

Thanks for your thoughts.

If you suggest 2 or 3, some additional hints where to get the component, library or source would be appreciated.
S. Tanna
Friday, September 17, 2004
Depends on your target market, but I would say either 1 or 3. Don't roll your own, FTP components are two a penny these days, you'll waste weeks.

If you want specific recommendations on FTP components, I would say Dart are pretty good.
Andrew Cherry Send private email
Friday, September 17, 2004
What language are you coding in?  That might help people to make relevant component recommendations.
John Rusk Send private email
Friday, September 17, 2004
Microsoft VC++, MFC

And it needs to work with at least Win98 or better, and preferably Win95 or better.

It's with free trial (shareware), and cheap, so royalty-required components are out.

It's delivered as a download, so anything that requires megabytes of downloadable frameworks is out too.
S. Tanna
Friday, September 17, 2004
I had a similar requirement (same idea but JPG files instead of HTML files).  For that project, I was using .NET.  After wasting time evaluating a bunch of crappy 3rd party components, I opted to write my own. 

If you're familiar with socket programming, it's not too hard.  You establish a control connection that passes some ASCII commands to the server and gets ASCII responses -- very simple stuff.  The data transfer part was a little tricky (see below) but basically just sending raw bytes once you've established the data connection.  I think it took me a few hours to get the core functionality in place and that involved a few misteps due to the RFC differing from common practice (which I'll tell you about below).  The end result is only about 500 lines of code (and this includes extra features such as LIST that you probably won't need). 

My advice if you roll your own:
1. Grab the RFC for basic reference.
2. Use the PORT command for establishing data connections rather than relying on the default port described in the RFC. 
3. Ignore all the fancy transfer types described in the RFC -- the simple stream type seems to be the only one commonly supported.
4. Run TcpTrace ( ) and watch some FTP sessions with a couple of FTP clients to get an idea of what they're doing (I wish I did this first!).
Somebody Send private email
Friday, September 17, 2004
For C++/MFC The Wininet API is a good choice.  Just search MSDN for functions like FtpGetFile, FtpPutFile, FtpOpenFile etc.  I've used these successfully in the past.
Saturday, September 18, 2004
Matthew Lock Send private email
Saturday, September 18, 2004
M.Lock - interesting link but a little scarey too!

The biggest thing that I'm worried about, is how will I know if the code works on everybody's (or most people's) FTP servers?  Scarey answer= I won't
S. Tanna
Saturday, September 18, 2004
I would probably use libcurl:
Saturday, September 18, 2004
I used WININET.DLL within in a VB app, to upload/download files. I seem to remember it was not to bad, using the available examples.

I later added the ability to use HTTP for uploading/downloading, again using WININET.DLL - this was a much bigger pain.

As a quick hack, could you shell out to command line FTP application. Passing it a file of instructions to perform the upload.
Sunday, September 19, 2004
If you get IPWorks by /n software, you not only get an FTP component but you also get about 30 other components too for $399.

Here are a couple of interesting ones that you get:

HTTP - Access the World Wide Web from your applications, including HTML forms.

FileMailer - The FileMailer control provides an easy way to send emails with file attachments.

IPDaemon - Generic TCP server component. Asynchronous, event-driven architecture (not available for Pocket PC).

IPInfo - A collection of DNS and other database functions. Both direct and reverse DNS queries. (not available for Pocket PC)

The rest are at:
Wayne Send private email
Sunday, September 19, 2004

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz