Show file browser dialog on page load

Last post 08-10-2009, 6:23 AM by timl. 8 replies.
Sort Posts: Previous Next
  •  08-05-2009, 5:42 AM 54503

    Show file browser dialog on page load

    Hi,
     
    I've created an ASPX form and have added a UploadAttachements control.
     
    Is there any way that I can automatically invoke the upload button and display the file browser dialog when my page loads?
     
    Many thanks,
    Tim
  •  08-05-2009, 9:21 AM 54511 in reply to 54503

    Re: Show file browser dialog on page load

    Tim
     
    You can try the 'startbrowse' method of the uploader object :
     
    <script>
    var uploader=document.getElementById('<%=Uploader1.ClientID%>');
    uploader.startbrowse();
    </script>
     
    But it will not work for :
    Silverlight v3.0
    Flash v10
     
    Regards,
    Terry
     
  •  08-05-2009, 10:27 AM 54512 in reply to 54511

    Re: Show file browser dialog on page load

    Hi Terry,
     
    Many thanks for your reply.
     
    I've created a function using your javascript and have attached it  to the onload() event of my form.
     
    However, I get the the following javascript error on the uploader.startbrowse(); line when the page loads.
     
    Message: Object doesn't support this property or method

    If I call the same function from the onclick event of a hyperlink on the page, a blue panel appears on the page with an exclamation mark icon and the message 'File Browsing Dialog has been blocked'. There is hyperlink beneath this error message with the title 'Please click here and try again'. If I click on the hyperlink, the open file dialog opens successfully.
     
    Is there anything else that I can try in order to get this working on the load of the form?
     
    Thanks,
    Tim
  •  08-05-2009, 8:08 PM 54531 in reply to 54512

    Re: Show file browser dialog on page load

    Tim,
     
    The AjaxUploader may still loading.
     
     
    Please try this :
     
    function CuteWebUI_AjaxUploader_OnInitialize()
    {
        var hidden=this;
        hidden.startbrowse();
    }
     
    Regards,
    Terry
  •  08-06-2009, 4:48 AM 54547 in reply to 54531

    Re: Show file browser dialog on page load

    Thanks Terry,
     
    That works fine now! 
     
    With the code above, I was still getting the 'File Browsing has been blocked' dialog but following the thread below and setting the uploadType to Iframe has resolved that.
     
    http://cutesoft.net/forums/thread/53747.aspx 
     
    Thanks once again,
    Tim 
     
  •  08-06-2009, 8:39 AM 54552 in reply to 54547

    Re: Show file browser dialog on page load

    Hi,
     
    We you use IFrame mode , in firefox it still will not show the dialog because Firefox do not allow the file.click() function.
     
    And when you use IFrame mode, it will not support multiple select feature .
     
    Regards,
    Terry
     
  •  08-07-2009, 10:59 AM 54572 in reply to 54552

    Re: Show file browser dialog on page load

    Thanks Terry,
     
    Are there any plans to support the multiple select feature in Iframe mode in future releases?
     
    Tim
  •  08-08-2009, 8:58 PM 54580 in reply to 54572

    Re: Show file browser dialog on page load

    Tim
     
    No. the IFrame mode use <input /> to show the dialog , it only support 1 file.
     
    But you can show some description text , to let the users click the button again and again .
     
    When MultipleFilesUpload=true , the IFrame mode still support file upload queue.
     
    Continue selecting a file , that file will be added into that queue.
     
    Regards,
    Terry
  •  08-10-2009, 6:23 AM 54603 in reply to 54580

    Re: Show file browser dialog on page load

    ok - thanks Terry
     
    Tim
View as RSS news feed in XML