Getting Files to and from the Client File System
The Application Builder provides some ways of getting files to and from the client file system when running an application. The following ways of getting files work both when running the web client and when running the native client.
Use the file import form object (see File Import) to ask the user for a file. The user browses to a file on the client file system that is then uploaded to the server and available to the application and its methods. This method can be used, for example, to provide a CAD file or experimental data from the user at runtime.
You can call the fileOpen function from any application method. It picks any file from the server produced by a method, the model, or embedded with the application and opens it using the associated application on the client. This method can be used, for example, to open a PDF document on the client or show a text file or an image exported from the model on the client.
It is also possible to call the fileSaveAs function from any application method in a way that is similar to fileOpen. It takes any file from the server and presents a Save As dialog where the user can browse to a client location to save the file. A call to fileSaveAs is typically preceded by some code that exports the file contents to the source for the fileSaveAs command. This method is similar to downloading files from a link within a web browser.
The Save Application As, Save Application Copy As, and Save Application on Server As commands are available in the command sequence tree for buttons and menu items in a form. These commands present a Save As dialog where the user can specify a client path where the entire application is saved. If the application is run on COMSOL Server, these commands save the current state as a new application in the COMSOL Server Application Library.