473,503 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Upload Size

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
Oct 12 '08 #1
6 2314
On Oct 12, 9:34*am, rodmc <userprogoogle-...@yahoo.co.ukwrote:
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:
http://www.python.org/doc/2.5.2/lib/module-ftplib.html

Mike
Oct 12 '08 #2
On 13 Oct, 00:10, Mike Driscoll <kyoso...@gmail.comwrote:
On Oct 12, 9:34 am, rodmc <userprogoogle-...@yahoo.co.ukwrote:
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:http://www.python.org/doc/2.5.2/lib/module-ftplib.html

Mike
Hi Mike,

Thanks for this information I will look at it. The only condition is
that everything must run via a webpage.

Best,

rod

Oct 13 '08 #3
rodmc wrote:
On 13 Oct, 00:10, Mike Driscoll <kyoso...@gmail.comwrote:
>On Oct 12, 9:34 am, rodmc <userprogoogle-...@yahoo.co.ukwrote:
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:http://www.python.org/doc/2.5.2/lib/module-ftplib.html

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
announced.

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

Diez
Oct 13 '08 #4
On Oct 13, 11:55 am, "Diez B. Roggisch" <de...@nospam.web.dewrote:
rodmc wrote:
On 13 Oct, 00:10, Mike Driscoll <kyoso...@gmail.comwrote:
On Oct 12, 9:34 am, rodmc <userprogoogle-...@yahoo.co.ukwrote:
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:http://www.python.org/doc/2.5.2/lib/module-ftplib.html
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
announced.

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

Diez
Thanks. I have basic file uploading working, however is there a limit
to what can be uploaded via form? It works perfectly for up to around
20MB then breaks. Also how do I retrieve the content-length header? I
am quite new to HTTP programming so sorry for the naive questiomn.

Best,

rod
Oct 24 '08 #5
Thanks. I have basic file uploading working, however is there a limit
to what can be uploaded via form? It works perfectly for up to around
20MB then breaks.

There is no limit, but the larger the upload, the larger the chance of a
failure. I'm currently not exactly sure if there is a way to overcome
this with a continuous upload scheme for browsers - maybe google helps.
Also how do I retrieve the content-length header? I
am quite new to HTTP programming so sorry for the naive questiomn.

That depends on your HTTP-framework/libraries of choice.

Diez
Oct 24 '08 #6
Hi Diez,

Thanks, I will look on Google again, to date though all examples I
have used come up against similar problems. As for HTTP framework and
libraries, I will see what is currently supported. At present I am
using standard Python libraries.

Best,

rod

Oct 24 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3910
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
5
5432
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
4
5989
by: Joe | last post by:
Hello, I have IIS 6.0 running on w2k3 Enterprise. I have three upload forms 1 to have restricted uploads .asp 2 to upload plain .asp any extension 3 a FP form upload non .asp
1
2746
by: BW | last post by:
I am creating an upload/download function for an extranet site. Files will be uploaded to directory based upon the users login and associated project. The function works as long as I use "c:\Temp"...
18
4316
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
4
5879
by: Jim Michaels | last post by:
after a file upload, $_FILES is not populated but $_POST is. what's going on here? $_POST=C $_POST=C $_POST=C $_POST=C:\\www\\jimm\\images\\bg1.jpg $_FILES= $_FILES= $_FILES=
2
7626
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but...
1
5435
by: chrisj | last post by:
I'm using freeASPupload and got some assistance integrating to a Member script. It works successfully. In this modified version there are two groups that use this upload script. Members of one...
4
2913
cassbiz
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of...
6
3817
Jacotheron
by: Jacotheron | last post by:
I need a PHP script that can upload music files (mp3). The script is for a home project I have started a while ago. I have a MySQL database of all the music that I have. Other computers on the...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.