File Upload Size

Diez B. Roggisch deets at
Mon Oct 13 11:55:36 CEST 2008

rodmc wrote:

> On 13 Oct, 00:10, Mike Driscoll <kyoso... at> wrote:
>> On Oct 12, 9:34 am, rodmc <userprogoogle-... at> wrote:
>> > Hi,
>> > Is there a way to get the size of a file on a remote machine before it
>> > is uploaded? I would like to write some form of status counter which
>> > is updated as a fie is uploaded, and also to use this feature to
>> > prevent files which are too big from being uploaded.
>> > Best,
>> > rod
>> Looks like ftplib does that. Check the
>> docs:
>> Mike
> Hi Mike,
> Thanks for this information I will look at it. The only condition is
> that everything must run via a webpage.

Which is crucial information and rules out Mike's suggestion.

And the answer is: no, you can't access file-attributes on remote machines.
HTTP does require a content-length header though. If that exceeds a certain
size, you can terminate the connection.

You need to do that also if the client actually pushes more data than

And progress-counting can be done by counting the already arrived data &
making e.g. an Ajax-Call to fetch that from the server.


More information about the Python-list mailing list