Topic: FileUploaded not firing

Hi,

I've upgraded to Plupload 1.3.0 and it seems Flash runtime no longer fire FileUploaded callback on FF/IE.

It's seems sometimes it stops at the middle of the upload.

It works fine with HTML5, Silverlight runtimes. I use Flash 10.1. I use Multipart upload with small files.

I see fixed bug about FileUploaded  on GitHub, is it a new bug ?

Regards

Re: FileUploaded not firing

Up,

Does FileUploaded() callback is called for you in a multipart upload with flash runtime ?

The sample here works in chunk mode.

Re: FileUploaded not firing

Couldn't reproduce it here:
http://www.plupload.com/example_events.php

Fired the FileUploaded event for a small zip file. So chunking didn't occur.

Re: FileUploaded not firing

Well, I could not select zip here (http://www.plupload.com/example_events.php)

But I did a Proof Of Concept (cut&past from custom example + modif for prototype library):

- If I replace runtime 'flash' by 'html5' I get the alert.
- It used to work in previous plupload version.
- I upload a single little image


HTML

<form action="debug/debugPlupload.jsp" method="post" name="fileUploadForm" enctype="multipart/form-data">
  <div id="plupload-container">
    <div id='plupload-browse'>BROWSE</div>
    <div id='plupload-logs'>Logs</div>
  </div>
  <input id="plupload-submit" type="button" value='UPLOAD' name="opUpload" />

</form>

JavaScript

    var uploader = new plupload.Uploader({
        runtimes : 'flash',
        browse_button : 'plupload-browse',
        container :     'plupload-container',
        max_file_size : '10mb',
        url :                 '/en/jcore/plupload.jsp',
        flash_swf_url :       '/en/js/lib/plupload/plupload.flash.swf',
        silverlight_xap_url : '/en/js/lib/plupload/plupload.silverlight.xap',
    });

    uploader.bind('Init', function(up, params) {
        $('plupload-logs').update("<div>Current runtime: " + params.runtime + "</div>");
    });

    $('plupload-submit').observe('click',function(e) {
        $('plupload-logs').update("<div>Start</div>");
        uploader.start();
    });

    uploader.init();

    uploader.bind('FilesAdded', function(up, files) {
        
        $A(files).each(function(file,idx){
          $('plupload-logs').update("<div>"+file.name+" </div>");
        });

        up.refresh(); // Reposition Flash/Silverlight
    });

    uploader.bind('Error', function(up, err) {
        $('plupload-logs').update("<div> Error: "+err.message+"</div>");
        up.refresh(); // Reposition Flash/Silverlight
    });

    uploader.bind('UploadProgress', function(up, file) {
      $('plupload-logs').update("<div>"+file.id+" "+file.percent+"%</div>");
    });

    uploader.bind('FileUploaded', function(up, file) {
        alert('FileUploaded');
        $('plupload-logs').update("<div> Uploaded: "+file.name+") </div>");
    });

May be I have to something new on server-side pipes ? But it seems weird.


PS: Is there custom advanced support for licensed version ?

Re: FileUploaded not firing

Hmm... strange... fires for me nicely here on Mac too.

Is your issue consistent across browsers? What OS do you use?

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: FileUploaded not firing

Well I got the probleme, may be, since Flash 10.1 update and Plupload 1.3.0 ?

I'm using Windows Vista. I have a colleague with the same issue on Windows Seven and an other on Linux.

I need to know when all files have been uploaded, may be threre is a workaround ?

On server side we read the multipart request and decode it normally.

7 (edited by NextOne 2011-01-04 14:31:28)

Re: FileUploaded not firing

Bump.

When putting trace in code (plupload.flash.js):

- I got Flash:Init
- I got Flash:SelectFiles
- I got UploadFile
- I got Flash:UploadProcess

The file is correctly send to the server, I got trace on server side with the file.


I try to add like the others :
uploader.bind("FileUploaded", function(up) {
  alert("FileUploaded");
});


On the other way, it seems in the source code, FileUploaded is trigged only by "Flash:UploadChunkComplete" called only in chuck mode but I am in multipart mode.


EDIT 1: on a larger file, I correctly get 'UploadProgress' event and I correctly display the progress bar. But I do not get the 'FileUploaded' event.

In the code no where 'FileUploaded' is fired. The only function that call it is the callback to 'Flash:UploadChunkComplete' that is never called because we are not in chunk mode.

EDIT 2: The callback of 'Flash:UploadProcess' event always return a status of '2' that means UPLOADING.

EDIT 3 : I do not have stuff ti compile ActionScript, do you have a Flash version with traces ? To be sure callback of simpleUpload() on DataEvent.UPLOAD_COMPLETE_DATA is correctly called.

Re: FileUploaded not firing

Works for me, tested this page.
http://www.plupload.com/example_events.php

Added a zip file like 5k.

Got:

[Init] Info: runtime=flash Features: jpgresize=true, pngresize=true, chunks=true, progress=true, multipart=true
[Refresh]
[FilesAdded]
  File: id=p15l98qe16tge1oh61163if6bgm1, name=basic.zip, size=3512, loaded=0, percent=0, status=QUEUED
[QueueChanged]
[Refresh]
[Refresh]
[StateChanged] STARTED
[Refresh]
[UploadFile] id=p15l98qe16tge1oh61163if6bgm1, name=basic.zip, size=3512, loaded=0, percent=0, status=UPLOADING
[ChunkUploaded] File: id=p15l98qe16tge1oh61163if6bgm1, name=basic.zip, size=3512, loaded=0, percent=0, status=UPLOADING, target_name=p15l98qe16tge1oh61163if6bgm1.zip Info: chunk=0, chunks=1, response={"jsonrpc" : "2.0", "result" : null, "id" : "id"}
[UploadProgress] File: id=p15l98qe16tge1oh61163if6bgm1, name=basic.zip, size=3512, loaded=3512, percent=100, status=DONE, target_name=p15l98qe16tge1oh61163if6bgm1.zip Total: size=3512, loaded=3512, uploaded=1, failed=0, queued=0, percent=100, bytesPerSec=10484
[FileUploaded] File: id=p15l98qe16tge1oh61163if6bgm1, name=basic.zip, size=3512, loaded=3512, percent=100, status=DONE, target_name=p15l98qe16tge1oh61163if6bgm1.zip Info: response={"jsonrpc" : "2.0", "result" : null, "id" : "id"}
[UploadProgress] File: id=p15l98qe16tge1oh61163if6bgm1, name=basic.zip, size=3512, loaded=3512, percent=100, status=DONE, target_name=p15l98qe16tge1oh61163if6bgm1.zip Total: size=3512, loaded=3512, uploaded=1, failed=0, queued=0, percent=100, bytesPerSec=9702
[StateChanged] STOPPED
[Refresh]

As you see both FileUploaded and UploadProgress fired correctly.

Re: FileUploaded not firing

Thanks, well as a developer I understand the statement "Works on my machine" and indeed the online sample works for me.

What I would like to known is why my sample no longer works ?

- It used to works before 1.3.0
- It works perfectly with HTML5, Silverlight, Gears runtimes
- It works perfectly on IE/FF/Chrome

But for Flash it do not work with my old code anymore.

I think it 's something really simple that changed in the API, but I need clue to find it.
- Our server only accept Multipart data not chunk.
- File seems to be correctly send

I put alert() in all binds of "plupload.flash.js" and it seems "Flash:UploadProcess" is called but "Flash:UploadChunkComplete" is never called.

According to ActionScript File:
- FileUploaded is fired by Flash:UploadChunkComplete
- fired by UploadChunkEvent.UPLOAD_CHUNK_COMPLETE_DATA
- fired by DataEvent.UPLOAD_COMPLETE_DATA
- fired when the file is uploaded ?

As a side note, very few times, my file is not fully send and hang at 35%.

10 (edited by NextOne 2011-01-05 12:19:58)

Re: FileUploaded not firing

Ok I think I find 2 issues ! smile

1. In fact server must return anything like "DONE" in response. Then Flash continue it's process and all callback are correctly called.

So problem solved !

2. It seems request performed by Flash do not use J2EE cookie. So the ServerSide Session is not the same as browser session.

Is my guess correct ? Is there a work around ?

The same test with HTML5 runtime works fine.

Re: FileUploaded not firing

Thanks NextOne! I can confirm that for the flash runtime, FileUploaded is not fired unless the server returns non-empty content. For at least HTML4/5 this is not required. In my opinion, it would make sense, if just the HTTP header status code was sufficient for determining whether the FileUploaded should be fired or not.

This in fact introduces another issue I discovered with IE browsers. Since the flash runtime seems to be somewhat dependent on the response content, returning some mumbo jumbo may result in "Error on page" notification on IE. (At least I got "Expected hexadecimal digit"-error which suggests unescaped stuff in the returned content.)

Re: FileUploaded not firing

Hi,

Well, I did not see errors on IE7/IE8 at the moment

But on IE6 (grrr I hate that browser) Flash Runtime of Plupload open a new window and display the dummy text !

I agree all runtimes should have the same behavior

Re: FileUploaded not firing

Looks like we got quite a lot of info here. I will get to it, once time admits.

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: FileUploaded not firing

@Lemmy Koopa, it seems that when you do not return a response from the server even DataEvent.UPLOAD_COMPLETE_DATA is not dispatched, how could you get HTTP header status code without it?

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: FileUploaded not firing

@NextOne:

2. It seems request performed by Flash do not use J2EE cookie. So the ServerSide Session is not the same as browser session.

You will need to send your session id with the upload and restore it on server-side. That has been usual issue with all other flash based uploaders using FileReference. That's why using chunking and URLStream for example maybe beneficial, if the usage scenario allows of course.

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: FileUploaded not firing

davit wrote:

@NextOne:

2. It seems request performed by Flash do not use J2EE cookie. So the ServerSide Session is not the same as browser session.

You will need to send your session id with the upload and restore it on server-side. That has been usual issue with all other flash based uploaders using FileReference. That's why using chunking and URLStream for example maybe beneficial, if the usage scenario allows of course.

Yes, that what I thought. The tricky thing is the behavior is not the same between runtimes.

For my workaround, I no longer use the session but instead a LRUMap server side with unique id.

Re: FileUploaded not firing

Yes. When I worked with CakePHP, Flash used to break my sessions with it's own user-agent.

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: FileUploaded not firing

I too had this issue on Vista.

Re: FileUploaded not firing

Vista was an issue. I am using windows 7 now and no issues

Re: FileUploaded not firing

hello..

Re: FileUploaded not firing

Your style is so unique compared to many other people thank you for sharing the info I found helpful details.

Re: FileUploaded not firing

Hey, looks like reproducible again, I have submitted an issue on Github (tho no reaction there...)

https://github.com/moxiecode/plupload/issues/444

Re: FileUploaded not firing

Guys, any chance I will get at least a response?
This is a blocker issue, and we are going to become your paid customer iff it's fixed

Re: FileUploaded not firing

One thing that is not here that I think should be part of this game, click on it and play it. Your spirit will improve after a day of hard work and study. Have fun!
fireboy and watergirl 4
dumb ways to die