FileReference bytesLoaded - incorrect value?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cbellew
    New Member
    • Sep 2007
    • 26

    FileReference bytesLoaded - incorrect value?

    Hi guys, i wonder if anyone could help me with my problem.

    Basically, i am creating a file upload tool in as3. I am using a FileReference object, calling browse() and then upload(). I have an event listener catching ProgressEvent.P ROGRESS Events and using ProgressEvent.b ytesLoaded to update a progress bar.

    The bar works fine, but i only get expected results when the swf and receiving php script are both local. I.E. on my localhost. The bar increases steadily and completes. However, when i use the swf and script on my external testing server the bar will fill immediately and bytesLoaded will be equal to bytesTotal instantly - even if the file is a few MB!).

    I assume this must be something to do with php??

    Any help would be much appreciated!

    Thanks

    Chris

    P.S. Code...

    Code:
    var file:FileReference = new FileReference();
    file.addEventListener(Event.SELECT, selectHandler);
    file.addEventListener(ProgressEvent.PROGRESS, progressHandler);
    
    function selectHandler(e:Event)
    {
    	file.upload(new URLRequest("http://www.trancetutorials.com/testupload.php"), "image");
    }
    
    function progressHandler(e:ProgressEvent):void
    {
    	progressBar.width = (e.bytesLoaded / (e.bytesTotal / 100)) * 3;
    	progressBox.text = (e.bytesLoaded / (e.bytesTotal / 100)) + "%";
    }
    
    file.browse();
  • tominko
    New Member
    • Jan 2010
    • 1

    #2
    the same problem

    hi, i know its bit late, but i want to ask if you sorted that problem because i have the same... little bit stranger - all is working fine from my home (i tested it on mac and windows as well) but its not working from office (exactly how you describing)

    Comment

    • tomulesei
      New Member
      • Jun 2010
      • 1

      #3
      Hi,

      Have the same problem, any solutions here?
      thanks

      Comment

      Working...