Hey, Folks:
I'm writing a CGI to handle very large file uploads. I would like to
include a progress bar. I think I'm about done. I have code to handle the
file upload, and I think I can add an IFrame to my page which posts to check
file size (so I can tell how many bytes have been received). My problem is
that I want to provide a % complete. In order to do that, of course, I need
to know not only the number of bytes received, but also the total number of
incoming bytes. Here's the heart of the code:
while afcommon.True:
lstrData = lobjIncomingFil e.file.read(afc ommon.OneMeg)
if not lstrData:
break
lobjFile.write( lstrData)
llngBytes += long(len(lstrDa ta))
lobjFile.close( )
Assume that lobjIncomingFil e is actually a file-type element coming from
CGI.FieldStorag e. It's already been tested to ensure that it is a file-type
element. Also, assume that I've already opened a file on the server,
referred to by lobjFile (so lobjFile is the target of the incoming data).
If this were a client application opening a file, I would just do the
following:
import os
print os.stat('myfile .dat')[6]
But, of course, this isn't a local file. In fact, it's not really a file at
all. It is the contents of a file already rolled up into the HTTP header of
the incoming HTTP request to the Web server. The CGI module is kind enough
to handle all of the really hard stuff for me (like unpacking and decoding
the header contents, etc.). But, I still need to know the size of the
incoming file data.
Of course, I could do this by reading the whole thing into a string variable
and then testing the length of the string, as follows:
s = lobjIncomingFil e.file.read()
SizeOfFileIs = len(s)
But that really defeats the purpose, since my whole goal here is to provide
a progress bar, which is contingent upon a "chunking" approach. Besides,
for the file sizes that I'll be dealing with, I surely wouldn't want to read
the whole thing into memory.
So, bottom line: Does anyone know how to get the size of the incoming file
data without reading the whole thing into a string? Can I do something with
content_header?
Thanks much for any insight that you might have.
Doug 1 3531
> So, bottom line: Does anyone know how to get the size of the incoming file data without reading the whole thing into a string? Can I do something with content_header? http://www.faqs.org/rfcs/rfc1867.html
It seems that _maybe_ you can use the content-length http header. But it
looks as if it's not mandatory in this case - and of course uploading
multiple files will only allow for an overall percentage.
Diez This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: OneSolution |
last post by:
Hi All,
Here's one thing that I don't know much about - file uploading. As part of
my project, I will have to build a file manager of sorts - perhaps a
document manager. Anyhow, this involves allowing my user to upload files to
a location.
I know PHP can do it - I know this because it sure does everything else ...
but I don't know this from any authoritative source.
|
by: Todd Denlinger |
last post by:
Ok,
I know how to upload a file in asp.net using the <input
type="file" runat="server"> control. What I don't know
how to do is monitor the progress of the upload so that I
can show the end-user a progress bar, or something.
Anyone have any ideals or can point me to a sample?
Thanks,
|
by: Keith Rebello |
last post by:
I have a couple of progress bars that indicate the progress of a
math-intensive application. They are working well. The only problem is
that the progress indicator is gray in color.
Is it possible to change the color of the bars - they're usually blue in
other applications? Any help would be greatly appreciated. I'm using
VB.Net Standard, 2003.
|
by: JMB |
last post by:
Hello,
I was wondering if anyone knew of any projects extending the inline upload
progress bar to utilize an inpage image uploader with bar, without having to
refresh or go to a seperate page, nor opening a second box for display of
the progress bar.
I had been using the MegaUpload that was adapted from Raditha's script at
http://www.raditha.com/upload.php . The MegaUpload script I have been using
takes the progress bar inpage,...
|
by: Marko Vuksanovic |
last post by:
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is it possible to implement it using some other control, for example a floating window?
| |
by: LtCommander |
last post by:
Hello all,
1. I am a little new to ASP.NET, so please bear with me.
2. I am trying to create a very simple website which requires an upload
box (end user file sizes may be anywhere between 1MB to 10 MB).
3. I would also like to show a progress bar so that the user can see
the progress of what he is uploading.
|
by: markus.rietzler |
last post by:
i want to do (multiple) file upload(s) and display a progress bar.
with firefox and safari it is no problem at all. only IE makes some
problems.
my script is based on ajax-uploader, which can be found at
www.srmiles.com/freestuff/ajax_file_uploader/ . you can do multiple
file uploads. each upload will have it's own "form"-tag, so that each
file is uploaded for its own. could be a good solution if there are
"big" uploads.
|
by: John Devlon |
last post by:
Hi,
Some people like to go on vacation during christmas time, others try to do
something they never did before....
I would like to create a multiple file upload page, with some nice progress
bars....
You can buy ceveral components on the web but wheres the fun in that ?
Creating a page that uploads multiple files, without the progress bar is not
|
by: darrel |
last post by:
I briefly researched this a year or so ago for a project that never
materialized, but now I'm in the midst of one and need to look into this a
bit more.
I'm working on a site where the client want people to be able to upload
files up to 50mb in size via the web site. It's a contact form. Form
information is emailed, file is uploaded to server, and client can then
click on a link to go download the file that was uploaded.
Due to the...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |