When I am uploading from my localhost it display wrong amount transfer data per sec.
Below is the script I have found on this site, but.
I can upload the file so its seasier for you to understand. If you like the originals code and my modifications just take itCode:// Declarations var totalBytes:Number = 0; var uploadedBytes:Number = 0; var uploadedBytes2:Array; var startTime:Number; var sec:Number; // On that function/event fileRefListener.onOpen = function (fileRef:FileReference):Void { // timer is starting here startTime = getTimer(); } // Note this is fileRefListener.onProgress event, when the file is uploading fileRefListener.onProgress = function (fileRef:FileReference, bytesLoaded:Number, bytesTotal:Number):Void { // Calculate time in 1000 when the file is starting to upload, just a simple // timer var millisecsPassed:Number = getTimer() - startTime; // Here is the core of the rate calc, uploaded data devided with // the time that has passed from start. var rate:Number = Math.round(uploadedBytes/millisecsPassed); //Time to finish, total data // divided with amount of data loaded. ElepsedTime = Math.round((totalBytes/rate)); // Output to the stage Time.text = "Time remaining: " + time_to_string(ElepsedTime-millisecsPassed); Speed.text = "Transfer rate: " + GetSizeType(rate) + "/sec"; UpTime.text = "Elepsed Time: " + time_to_string(millisecsPassed); } //Converters Below, finished functions I found on internet. // Converts data function GetSizeType(size:Number) { if(size < 1024) return int(size*100)/100 + " bytes"; if(size < 1048576) return int((size / 1024)*100)/100 + "KB"; if(size < 1073741824) return int((size / 1048576)*100)/100 + "MB"; return int((size / 1073741824)*100)/100 + "GB"; } // Converts raw time (timer()) 1000 to hundredths, seconds // minutes and ahours function time_to_string(time_to_convert) { elapsed_hours = Math.floor(time_to_convert/3600000); remaining = time_to_convert-(elapsed_hours*3600000); elapsed_minutes = Math.floor(remaining/60000); remaining = remaining-(elapsed_minutes*60000); elapsed_seconds = Math.floor(remaining/1000); remaining = remaining-(elapsed_seconds*1000); elapsed_fs = Math.floor(remaining/10); if (elapsed_hours<10) { hours = "0"+elapsed_hours.toString(); } else { hours = elapsed_hours.toString(); } if (elapsed_minutes<10) { minutes = "0"+elapsed_minutes.toString(); } else { minutes = elapsed_minutes.toString(); } if (elapsed_seconds<10) { seconds = "0"+elapsed_seconds.toString(); } else { seconds = elapsed_seconds.toString(); } if (elapsed_fs<10) { hundredths = "0"+elapsed_fs.toString(); } else { hundredths = elapsed_fs.toString(); } // return hours+":"+minutes+":"+seconds+":"+hundredths; return +minutes+":"+seconds; }. But please try help me with this problem :S.
Becouse of the attachment limit I have uploaded in a free hosting site. Link for download is below.
http://www.sendspace.com/file/8fcr7k


. But please try help me with this problem :S.
Reply With Quote