File Schemes and File Handling
Transferring Files from Server to Client
To transfer files from a COMSOL Server to the client application, do not add any File node under Declarations, and follow these steps:
1
Write the data to temp:///output.data, for example.
2
Add temp:///output.data as the argument to a downloadtoclient action.
For assistance when defining the argument for the downloadtoclient action, click the Edit Argument button () to open an Edit Argument dialog box (see Editing Initial Values and Arguments in Declarations and Command Sequences), where you can choose one of the file schemes below from the File scheme list. You then specify the filename (such as output.data) in the Filename field. For the embedded:/// file scheme, choose an existing file in the application from the list under Choose an application file resource. Click OK to close the dialog box and fill the Arguments field with the selected file scheme and filename.
File Schemes
Anywhere in the model or application where a file path is given that would normally refer to a file on the client file system, you can instead use a scheme syntax such as <scheme>:///... to refer to a file that should be taken from somewhere else on the server. The following table includes the available schemes and where the files exist when running from the Application Builder and COMSOL Server.
Table 4-3: File Schemes
user:/// or
temp:/// depending on target
user:/// or
temp:/// depending on target
Random subdirectory of .comsol/v60server/service/users/[username]
In .comsol/v60/applications/files/common
In .comsol/v60server/applications/files/common
In .comsol/v60/applications/files/user
In .comsol/v60server/applications/files/users/[username]
Files saved to the temp scheme do not persist between multiple runs of the same application, even for the same user. Files saved to the user scheme persist and can be accessed by the same user, even for other applications. Files saved to the common scheme persist and can be accessed by all users for all applications.
You can modify the default locations separately using the following preferences settings.
URI Syntax
File scheme strings are uniform resource identifiers (URIs) as defined by RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt). In addition to what is allowed by RFC 2396, the file schemes allow any nonreserved Unicode characters in the path segments. This means that spaces do not need to be escaped in file and directory names. Sequences of escaped octets (for example, %20) are decoded as UTF-8. Currently, the file schemes do not use the authority component; that is, they are always on the form <scheme>:///<path> with three initial slashes.