platform.getOpenFileName

The 'getOpenFileName' function displays the common 'Open File' dialog box, whereby end-users can browse the file system and select a file.
getOpenFileName函数用来显示打开文件对话框,用户可以浏览文件系统和选择单个文件

  • Prototype: platform.getOpenFileName({

    • sTitle: '',
    • sInitDir: '',
    • sFilter: 'All files (*.*)'

    });

  • Parameters: an object containing,

    1. sTitle: the dialog box title;
      对话框标题
    2. sInitDir: an initial directory;
      初始文件夹
    3. sFilter: file type filters;
      文件类型
  • Return Value: a file path is returned if the OK button is pressed; Otherwise undefined;

  • Example:
    var sFn=platform.getOpenFileName({sTitle: 'Select text file', sFilter: 'Text files(*.txt);;all files(*.*)'});