Hi i want to compress the file on the file during FTP file download. Is it possible to do that.
I have an application that downloads the files from remote FTP server as windows forms application using VB.net

Please help
Thanks

Dani AI

Generated

On-the-fly compression over FTP is possible but often more trouble than it’s worth for general file delivery. ’s final approach — creating the archive on the server and then downloading that archive — is the pragmatic choice in most cases because it avoids the tricky parts of streaming archive formats and partial-transfer handling. was correct to point out that many common file types are already compressed, so per-transfer compression may give little benefit. ’s pointer to compression tooling is relevant; the notes below focus on reliability and practical pitfalls when using a server-side zipping workflow.

Practical checklist

  • Create the archive atomically: write to a temporary filename and rename only after the archive is complete so clients cannot grab a partial file.
  • Transfer in binary mode and enable FTP resume support if downloads may be interrupted; verify final file size and checksum after transfer.
  • For server-side generation (PHP or similar) watch for execution timeouts, memory limits, and free disk space; offload large archives to a background job and expose a ready/URL flag rather than doing long synchronous requests.
  • Avoid holding whole files in memory on client or server; stream read/write and extract when possible. Use archive support that handles very large files (Zip64 or equivalent).
  • Preserve timestamps and attributes where important by recording them in the archive metadata or alongside the archive.

Troubleshooting and alternatives

  • If archives are corrupt or truncated, confirm the server finished writing and that the temporary/rename pattern was used. Check server logs, permissions, and PHP settings (timeouts/memory).
  • If compression ratio is poor, skip compression for already-compressed types (media, modern office formats).
  • For true in-transfer compression, consider an FTP server with built-in transfer compression or switch to an HTTP-based delivery that supports streaming compression and range requests.

Server-side zipping plus a robust download/verification step is usually the simplest, most reliable pattern for Windows clients.

Recommended Answers

All 5 Replies

Sorry for the title, it actuall is "Compress file on the fly during FTP file download"

Can you explain what you are really trying to do here? What type of file is this? Most file types don't do you any good unless you have the entire file downloaded, the exceptions being multimedia. However multimedia files are usually compressed for distribution so in this case I don't think it would make sense to implement compression on the fly.

There are three mechanisms for sending data over FTP: stream, block, and compressed. The compressed mechanism uses RLE compression. I think that may be what you're after? The protocol is old and as far as I know the original FTP RFC did not include compression logic, it was done after the fact. That being said I don't know how widely it is supported.

Serv-U offers what you're looking for:

I'm not sure if you have to use their client/server setup though.

Thanks,
Sknake, you provided a whole lot of information.

I solved my problem by using alternate method. I made a php page webrequest that will zip the files on the server and it gives me confirmation that file zip is successful.

And then i made a FTPWebRequest to download those zipped file and then unzip it on the local computer.


Any way i solved my problem.

Now that sounds like a good solution

Please mark this thread as solved if you have found an answer to your question and good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.