Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

OnComplete and OnCompleteAll not firing
  • Hi

    Im trying to get it to remove a queued up file from the list once that file has been uploaded. To do this, you would initialize uploadify as such:


    $(\"#fileUpload\").uploadify({
    'uploader': '/scripts/uploadify.swf',
    'cancelImg': '/images/cancel.png',
    'script': '/Album/Manage/',
    'fileDesc': 'Image Files',
    'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
    'multi': true,
    'auto': false,
    'simUploadLimit': 3,
    'scriptData': {'album_id':'7'},
    onComplete: function(event, queueID, fileObj, response, data){
    alert(queueID);
    }
    });


    In the above example, you'd replace alert(queueID) with $("#fileUpload").uploadifyCancel(queueID) - I just have the alert to let me know when the event fires - which never happens. I have used IE and Firefox and no difference in either. Does anyone have any experience with this?
  • It sounds like it's failing on the server side and never returning to the page - check your error logs.

    I am in a similar situation, debugging the same way as you:

    'onComplete': function(event, queueID, fileObj, response, data) {
    alert(event);
    alert(queueID);
    alert(fileObj);
    alert(response);
    alert(data);


    All of these are undefined... any thoughts?
  • Try changing the "script" variable to the full location of the script file... i.e.: '/Album/Manage/uploadify.php'.

    If it doesn't find the script file it errors out. Try firing this with onError instead of onComplete and see what happens.
  • @RonnieSan - thanks for your response. This was implemented in a .Net MVC application, hence it is pointing at a controller action here. The upload works fine, it just doesnt fire any of the events! Very frustrating as I KNOW its working for others :cry:
  • RESOLVED!

    Right, i gather this is about the only article on the entire internet (including the Uploadify documentation and support pages) that describes the quirks of Uploadify in a .Net MVC application!

    Having done extensive testing, I have seen that:
    1. If the script that accepts the uploaded files (specified in the uploadify initialize code as
    'script': '/Album/Manage/'
    ) does not return anything, Uploadify's response events dont fire - I gather that an error stops it processing. My script was an action in a controller whose return type was string. If there was an error, it returned the error as a string, otherwise returned nothing. All I did to fix this was make it return 'OK' if nothing went wrong instead of nothing.

    2. Passing script data (specified in the uploadify initialize as
    'scriptData': {'album_id':'7'}
    ) the way I was doing it was ALSO causing an error - I havent worked out why (and RonnieSan, the father of Uploadify, didnt seem to see anything wrong with it) so if anyone does know maybe they can respond to this post

    3. In lavertym's onComplete event handler code above, he used single quotes around it i.e.
    'onComplete': function(event, queueID, fileObj, response, data) {
    - when I tried it like this, I got the same result as he did which is incorrect, so it appears that you MUST NOT put single quotes around the event handlers e.g.
    onComplete: function(event, queueID, fileObj, response, data) {


    Hope this helps - if anyone needs assistance with .Net MVC implementation, just drop me a private message.
  • I believe I am running into a similar issue on Firefox with my Zend Framework implementation. However, in my case, I am returning a success message from the controller action. Funny thing is this works perfectly fine on IE. Also, it works well on IE & Firefox if my uploaded file size is smaller (i.e. if it takes less than 30 seconds to get a response from my PHP script). Any ideas?