Programmatically start download

Last post 04-24-2009, 3:50 AM by igorbaldacci. 2 replies.
Sort Posts: Previous Next
  •  04-23-2009, 11:47 AM 51443

    Programmatically start download

    Hi freinds,
    I have a multi uploader in my page and I would like to start the upload from e command menu and not pressing the start button of the ajaxuploader.
     
    For Example, in my code behind I would like to have:

    If
    strCommand = "UploadFile" Then
    ' Start the uploading
    [.....]
    End If
     
    Is it possible?
    Thanks a lot, Igor.
     
     
  •  04-23-2009, 8:04 PM 51468 in reply to 51443

    Re: Programmatically start download

    Igor,
     
    It's not a easy thing because starting upload is a client side behavior.
     
    If you are not using AJAX , the client side state already be disposed.
     
    So , if you use AJAX , you can just send JAVASCRIPT to start it :
     
    var uploader=document.getElementById('<%=Uploader1.ClientID%>');
    if(uploader.getqueuecount()>0)
    {
        uploader.startupload();
    }
     
    Regards,
    Terry
     
  •  04-24-2009, 3:50 AM 51491 in reply to 51468

    Re: Programmatically start download

    Hi Terry,
    thank you for your answere.
     
    Yes, I'm using AJAX (my Uploader is inside an UpdatePanel). I've tried to use your suggestion, I'm not an expert in javascript but I've created this function (UploadAttachmentFile is the ID of my Uploader, is It correct?):
     

    function StartMyUploadFile() {

       var uploader = document.getElementById(UploadAttachmentFile);

       if (uploader.getqueuecount() > 0) {

          uploader.startupload();

       }

    }

    Then I've abbined this function on the "javascript" event of my menu:
     
    <NineRays:FlyMenuItem CommandName="AggiungiFile" Text="Aggiungi File" AutoPostBack="True" Javascript="StartMyUploadFile" />
     
     
    ... but it doesn't work!
     
    Mybe I'm wrong somethings in the code?
     
     
     
     
View as RSS news feed in XML