Top  | Previous | Next

system.file.openFile

Description

Shows an "Open File" dialog box, prompting the user to choose a file to open. Returns the path to the file that the user chose, or None if the user canceled the dialog box. An extension can optionally be passed in that sets the filetype filter to that extension.

Syntax

system.file.openFile([extension])

Parameters

String extension - A file extension, like "pdf", to try to open. [optional]

Returns

String - The path to the selected file, or None if canceled.

Scope

Client

Examples

This code would prompt the user to open a file of type 'gif'. If None is returned, it means the user canceled the open dialog box.

 

path = system.file.openFile('gif')
if path != None:
   # do something with the file