locked
how to display fileopen dialog in jscript????? RRS feed

  • Question

  • User-656627144 posted

    hi

            i just wanna know how to display file open dialog box in jscript and how to get selected filename ??????????

     

     

    thanx in advance

    Saturday, September 1, 2007 11:41 AM

Answers

  • User-2005691517 posted

    You can use the following 

    function GetFilePath()
    {
    var dlg = new ActiveXObject('MSComDlg.CommonDialog');
    dlg.Filter = 'All Gif files (*.gif)|*.gif| ';
    dlg.MaxFileSize = 260;
    dlg.ShowOpen();

    return dlg.FileName;

    }

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 1, 2007 12:28 PM

All replies

  • User-2005691517 posted

    You can use the following 

    function GetFilePath()
    {
    var dlg = new ActiveXObject('MSComDlg.CommonDialog');
    dlg.Filter = 'All Gif files (*.gif)|*.gif| ';
    dlg.MaxFileSize = 260;
    dlg.ShowOpen();

    return dlg.FileName;

    }

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 1, 2007 12:28 PM
  • User798903548 posted

    Prashant, I might be wrong, but I believe that will only work in Internet Explorer.

    NC...

    Sunday, September 2, 2007 12:57 PM
  • User-2005691517 posted

    NC, you are correct. This code will work only in IE since it is using new ActiveXObject(...) 

    I should have mentioned this in my reply. 

    Sunday, September 2, 2007 7:41 PM
  • User798903548 posted

    Thanks, that is good to know.

    NC...

     

    Monday, September 3, 2007 8:36 AM