Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,446
    Thanks
    275
    Thanked 32 Times in 31 Posts

    ajaxuploader min js

    hi i have an ajax uploader and the issue i am having is that for example i have a 50MB video

    On IE that takes 16min to upload, the progress bar hits 100% and done.

    Whereas on firefox the video still takes 16 min but the progress bar hits 100% at 8 minutes and then the other 8 minutes its just sitting there seemingly doing nothing and then it will finish.

    This is upsetting my FF members because they think its broken.

    So i found this section of code in my ajaxuploader-min.js file and i think i have the correct function here to do this.

    What i would like to do is if the browser is not IE (FF AND ALL OTHERS) then i would like to slow the progress bar down by half and i think we can do that here with the math involved here but im not sure how.

    so if we can adjust this to test for IE or NOT and then if it is IE run normally, IF not then increment the progress bar at half speed of the normal process, i think that plan might work.

    ps.. if you need to see the whole file let me know..

    Thanks

    here is the function..

    Code:
    h.prototype.uploadAjax=function(){
            var a=this.AU.settings,b=this.file,c=this.currentByte,d=this.name,e=this.size,f=a.chunkSize,h=f+c,i=0>=e-h,k=b,l=h/f;
            this.xhr=new XMLHttpRequest;
            0==c&&this.AU.slots++;
            0==f?(k=b,i=!0):b.mozSlice?k=b.mozSlice(c,h):b.webkitSlice? k=b.webkitSlice(c,h):b.slice?k=b.slice(c,h):(k=b,i=!0);
            var j=this;
            this.xhr.upload.addEventListener("abort",function(){
                j.AU.slots--
            },!1);
            this.xhr.upload.addEventListener("progress",function(a){
                a.lengthComputable&&(a=Math.round(100*(a.loaded+l*f-f)/e),j.onProgress(a))
            },!1);
            this.xhr.upload.addEventListener("error",function(){
                j.onError(this.responseText)
            },!1);
            this.xhr.onreadystatechange=function(){
                if(4==this.readyState&&200==this.status)try{
                    var a=JSON.parse(this.responseText);
                    0==c&&(j.name=a.name);
                    if(-1== parseInt(a.status))throw a.info;
                    i?(j.AU.slots--,j.onFinish(a.name,a.size,a.status,a.info)):(j.currentByte=h,j.uploadAjax())
                }catch(b){
                    j.AU.slots--,j.onError(b)
                }
            };
    what i am thinking is that this line here (the math)

    Code:
    this.xhr.upload.addEventListener("progress",function(a){
                a.lengthComputable&&(a=Math.round(100*(a.loaded+l*f-f)/e),j.onProgress(a))
    could be changed to


    Code:
    &&(a=Math.round(100*(a.loaded+.5*f-f)/e),j.onProgress(a))
    
    i changed the 1 to .5  // not sure if that will work syntax wise
    Last edited by durangod; 07-11-2013 at 09:47 PM.

  • #2
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,446
    Thanks
    275
    Thanked 32 Times in 31 Posts
    nevermind, after testing and playing with some of the math i was able to trick it to think it was a larger file in the hope that it would not have the dead time after 100 percent but even when i extended the upload time in the progress bar by 100% more (200%) FF still does its crazy wait forever.

    So i am convinced that FF is just totally screwed up when it comes to uploads.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •