473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Javascript - Download/upload times w/bandwidth

Hi all,

I'm trying to come up with a script and I'm having a heck of a time...

I require users to enter the size (in MB or KB) of the attachment they
wish to transfer/upload. As they enter the number and move over to
the next field (using onBlur or...), I would like a popup/alert window
warning them that this attachment size would take "x" amount of time
based on a speed of 24 kilobits per second (kbps). If they are happy
with the amount of time, I wish to allow them to click OK (to carry on
with the transfer) or Cancel/No to cancel it.

Anyone can assist me on this? I find this is quite difficult and
would appreciate any assistance you could send my way.

Cheers
--P
Jul 20 '05 #1
4 5620

"- - Pierre" <ca****@canada.com> wrote in message
news:25**************************@posting.google.c om...
Hi all,

I'm trying to come up with a script and I'm having a heck of a time...

I require users to enter the size (in MB or KB) of the attachment they
wish to transfer/upload. As they enter the number and move over to
the next field (using onBlur or...), I would like a popup/alert window
warning them that this attachment size would take "x" amount of time
based on a speed of 24 kilobits per second (kbps). If they are happy
with the amount of time, I wish to allow them to click OK (to carry on
with the transfer) or Cancel/No to cancel it.

Anyone can assist me on this? I find this is quite difficult and
would appreciate any assistance you could send my way.

Cheers
--P

I don't have an answer for you - but I do know that pending the type of file
you want to download/upload, the results can differ - For example, a 500kb
txt file will transfer faster than a 500kb mp3, rm, jpg, gif or whatever
else type file.

This variation is not just due to filetype, but is in part related to the
browser and web server - I was told this (here) when working on streaming
media - I wanted to calculate the best streaming file to suggest to the
client pending their internet connection - and I thought I could do this by
timing a download of a small file.

I was told that because some browsers (and web surfers) support a
compression in tranzip similar to gzip that one might find on a unix/linux
box. Web Clients have headers that tell the web server what it is capable
of - If the web server is configured to compress it will do so automatically
for every web client that can support compression and some files (like
mp3/jpg/gif/streaming) have files that are already compressed and thus
further compression won't make much of a difference - whereas an html or txt
file will compress very well.

So - you can only guess the transfer times - but even then, some guesses can
vary tremendously - Also, when you think of it, if the web client is
reasonably modern and receiving a compressed file - it uncompresses it
automatically without user intervention and this requires client/computer
resources - which in itself can effect the 'download' time (ie the "save as"
dialog box will not have closed/completed until the full download has
finished.

So... I hope that gives you a rough idea - if you still want to give it a
try I'm sure someone here will offer some solution that might help in some
shape or form...

randell d.
Jul 20 '05 #2
Thanks Randell. I appreciate the info. However, I simply need an
approximation. You see, my users will be coming "thru" a satellite
connection and I wish to give them an idea of the time it would take
prior to clicking "save and close" and using this very expensive
connection. Anyway, thanks again and hopefully someone has an idea.
Anyone of you JS gurus???

Ciao,

--Pierre
"Randell D." <yo**************************@yahoo.com> wrote in message news:<0q3gb.29216$pl3.26800@pd7tw3no>...
"- - Pierre" <ca****@canada.com> wrote in message
news:25**************************@posting.google.c om...
Hi all,

I'm trying to come up with a script and I'm having a heck of a time...

I require users to enter the size (in MB or KB) of the attachment they
wish to transfer/upload. As they enter the number and move over to
the next field (using onBlur or...), I would like a popup/alert window
warning them that this attachment size would take "x" amount of time
based on a speed of 24 kilobits per second (kbps). If they are happy
with the amount of time, I wish to allow them to click OK (to carry on
with the transfer) or Cancel/No to cancel it.

Anyone can assist me on this? I find this is quite difficult and
would appreciate any assistance you could send my way.

Cheers
--P

I don't have an answer for you - but I do know that pending the type of file
you want to download/upload, the results can differ - For example, a 500kb
txt file will transfer faster than a 500kb mp3, rm, jpg, gif or whatever
else type file.

This variation is not just due to filetype, but is in part related to the
browser and web server - I was told this (here) when working on streaming
media - I wanted to calculate the best streaming file to suggest to the
client pending their internet connection - and I thought I could do this by
timing a download of a small file.

I was told that because some browsers (and web surfers) support a
compression in tranzip similar to gzip that one might find on a unix/linux
box. Web Clients have headers that tell the web server what it is capable
of - If the web server is configured to compress it will do so automatically
for every web client that can support compression and some files (like
mp3/jpg/gif/streaming) have files that are already compressed and thus
further compression won't make much of a difference - whereas an html or txt
file will compress very well.

So - you can only guess the transfer times - but even then, some guesses can
vary tremendously - Also, when you think of it, if the web client is
reasonably modern and receiving a compressed file - it uncompresses it
automatically without user intervention and this requires client/computer
resources - which in itself can effect the 'download' time (ie the "save as"
dialog box will not have closed/completed until the full download has
finished.

So... I hope that gives you a rough idea - if you still want to give it a
try I'm sure someone here will offer some solution that might help in some
shape or form...

randell d.

Jul 20 '05 #3
Sayeth Randell D. <yo**************************@yahoo.com>:

I don't have an answer for you - but I do know that pending the type of file
you want to download/upload, the results can differ - [...]
I was told that because some browsers (and web surfers) support a
compression in tranzip similar to gzip that one might find on a unix/linux
box. [...] and some files (like
mp3/jpg/gif/streaming) have files that are already compressed and thus
further compression won't make much of a difference - whereas an html or txt
file will compress very well.


Also, if your user is using a 56K modem, for example, there's all
sorts of data compression going on on the fly. And proxies to
confuse the situation. And if you just happen to be taking your
sample while they're downloading something else, or while someone
else sharing a cable with them is, or whatever ...

-----sharks
Jul 20 '05 #4
Ivo
ca****@canada.com (- - Pierre) wrote
warning them that this attachment size would take "x" amount of time
based on a speed of 24 kilobits per second (kbps). my users will be coming "thru" a satellite
connection and I wish to give them an idea of the time it would take
prior to clicking "save and close" and using this very expensive
connection.
Not tested throughout, but this should provide some basic functionality:
<input type=text onchange="ask(this)">
<script>
function ask(el){
size=el.value.toLowerCase();
sizeno=el.value.replace(/\D/g,'');
if(size.indexOf('kb')+1){sizeno=sizeno*1024;}
if(size.indexOf('mb')+1){sizeno=sizeno*1024*1024;}
seconds=Math.round(sizeno*8/24/1000);
msg='At 24kbps, ' + size + ' would take '
+ minsec(seconds)
+ '.\nWould you like to continue?';
if(confirm(msg))
{}//they accept
else
{el.value='';el.focus();}
}
function minsec(s){
m=Math.floor(s/60);
s-=60*m;
if(m)m+=' minutes and ';
return m+s+' seconds';
}
</script>
HTH
Ivo
Ciao,

--Pierre

Jul 20 '05 #5

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

Similar topics

1
by: ripken95 | last post by:
I connect to the internet through ADSL. I want to write the web page which can detect the connection status with javascript. This detection is like the signal detection in the mobile phone. If the...
6
by: nate | last post by:
Hello, Does anyone know where I can find an ASP server side script written in JavaScript to parse text fields from a form method='POST' using enctype='multipart/form-data'? I'd also like it to...
3
by: Gary O'Malley | last post by:
Everytime I download a file from the web I get a nice animated dialogue box that shows the size of the file, how much has been received and the approximate remaining time. It also gives the...
3
by: Demetri | last post by:
Hello, I'm involved in developing an application which has the need to transfer files automtically once a laptop is connected back to the network. The application i'm developing will...
5
by: gjzusenet | last post by:
Hello. Though Python supports threading, I think it is limited to python code - as soon as you issue a command that uses an external (C?) module, all of your python threads hang until this command...
2
by: Mike Kober | last post by:
I am having issues with the File Upload control for sending files to the server via HTTP. The speed of the upload is often between 20kbs and 40kbs. If I use the LAN at work to the server, it...
3
by: axelman | last post by:
Hi guys, I'm using Classic ASP, IIS6, IE 7, FF 3 I've developed a vb script to downloand files hosted in my server (zip, doc, pdf, jpg, xls, et. etc.) it's very straight forward and there's a ...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
1
by: cubicalmonkey | last post by:
Hello, I'm developing a network bandwidth test and I've encountered some obstacles surrounding an upstream test. Basically what I would like to do is download an image (say 20 a meg tiff) into a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
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
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,...

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.