[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Finding the size of a file prior to download



You already figured out the problem...
If it is not chunked, you can parse the header for the file size. If it is chunked the file size is determined on the fly.

So, an idea or two. Is the file sitting somewhere that you can see? Maybe you can FTP or even http browse the directory and see the files and their sizes? Obviously this would mean that the server would need that directory in the ftp server config or for http would need some files to NOT be present and some directives to be turned on. For Apache, see this page for that:

https://wiki.apache.org/httpd/DirectoryListings

If the file is being built on the fly, there just is not a good solution except to turn off chunking. 

I don't recall and don't have time to look it up but maybe you can "lie" to the server and tell it you are using http 1.0 and see if it will buffer the file for you. Then you could get the size in the header at the start of the download.


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Ian Patterson
Sent: Monday, September 15, 2014 1:21 PM
To: 'HTTPAPI and FTPAPI Projects'
Subject: Finding the size of a file prior to download

We use httpapi to download files (binary and SSL).
It would be useful to know what the file size is prior to downloading it.

We use GET with and without chunking but can't see a method to establish the download file size before the download.
Especially with chunked downloads where the content length is the chunk.

Any ideas anyone?

 
Regards
 
Ian Patterson
 

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------