• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

ProgressBar for xmlHttpRequest

hello,

I have an activeX app which is used to upload and download files, the way is does this is by encoding and decoding the files into xml then using the xmlHttpRequest method in VB to and from asp pages on the server which encode/decode (depending on up or download) and save the faile back in its original state.

To get round the progressbar issue over http what I have done is calculate the file size , estimate the network speed then divide the file size by network speed, set a progressbar max value to the result and fire off a timer which runs until the progressbar reaches its max value.

This isnt too inaccurate but I can forsee future inaccuracies with larger / smaller files and varying internet speeds.

SO can anyone suggest a way or gettting the progress of a file transfer using the xmlHttpRequest object

e.g getBytesLoaded in action script?

many thanks.

 
0
wdhough
Asked:
wdhough
1 Solution
 
BrianGEFF719Commented:
The only problem you will have is correctly determining remaining time.

Your system will work perfectly for displaying progress, however, if you want to display time remaining, I suggest you simply take an average.

 dim startTime as date
 dim bytesTransfered as long
 dim eSec as long
 dim rate as long
 dim totalBytes as long


 startTime = now



 eSec = datediff("s",now,startTime)
 rate = bytesTransfered / eSec 'bytes per sec


Does that make sense?
0
 
wdhoughAuthor Commented:
yeah wicked thanks.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now