Web Forms File Manager
When you deploy a PowerBuilder application as a .NET Web Forms application, PowerBuilder creates a virtual file system that Web Forms users can access from client-side Web browsers.
Virtual file system
The virtual file system is maintained on the server. Application users can read from and write to files in the virtual file system as long as user permissions for file operations are not restricted.
The virtual file system for a PowerBuilder Web Forms application is contained in the applicationName_rootFileCommon directory under the virtual root of the IIS server, where applicationName is the name of the current Web Forms application.
Subdirectories of the Common directory store read-only files that are shared by all users of a Web Forms application. PowerBuilder creates these subdirectories at deployment time. A top-level subdirectory is created for each development computer drive containing a file deployed with the PowerBuilder application. The entire path to each application file is mirrored in the virtual file system to reflect the path to the application files on the desktop file system. The name of each top-level subdirectory in the virtual file system consists only of a drive letter that mirrors the desktop drive from where an application file was copied.
This figure shows the Common directory and its subdirectories for the FilmCatalog Web Forms application. It also shows a SessionID subdirectory with a single subdirectory where a PDF file was written in Share mode:
At runtime, the Web Forms application creates a SessionID folder in the FileSession directory for each user for storing files uploaded or created by that user. The exact name of the SessionID directory is generated by the ASP.NET runtime engine.
File process mode
There are two file process modes: Share mode and Copy mode. The PBWebFileProcessMode global property defines the mode for the current Web Forms application. It is set to Share mode by default.
- Share mode � files are copied from the Common directory to the FileSessionSessionID or the FileUserUserName directory only as needed.
- Copy mode � in this mode, the first time a file operation is called, all folders and files under the Common directory are copied to the SessionID or UserName directory. In Copy mode, all file operations are handled in subdirectories of the SessionID or UserName directory.
The File Manager presents a merged view of the files under the Common and SessionID or UserName directories. If a read-only file in the Common directory has the same name as a read-write file in the SessionID or UserName directory, only the SessionID or UserName file is displayed.
Although users can delete and move folders or files that they create under the SessionID or UserName directory, files and folders that are copied from the Common directory cannot be deleted because the File Manager presents a merged view of these virtual file paths, and removing a file or folder from the SessionID or UserName directory does not cause its removal from the Common directory.
The common dialog boxes for all file operations are supported regardless of file process mode. You can display these dialog boxes with the GetOpenFileName, GetSaveFileName, and GetFolder functions.
File Manager icon
When you set the PBFileManager property to true, the File Manager icon normally displays in every window of your Web Forms application. Users can open the File Manager at any time by clicking the File Manager icon. You can also code an application event to open the File Manager by calling the OpenFileManager function.
Although you can choose to render the File Manager icon at design time, you can change your selection after deployment by modifying the application�s PBFileManager global property. If you do not want the File Manager icon to display on a specific window in your application, you can set the HasFileManager property for that window to false.
See HasFileManager and OpenFileManager.
The File Manager icon displays in the upper right corner of Web Forms, just to the right of the Mail Profile Manager icon when that icon is also rendered. The File Manager opens in the current browser window when a user clicks the File Manager icon.
This figure shows the File Manager for a Web Forms application:
- Creating a Directory with the File Manager
The File Manager allows users to create directories, rename and delete selected files or directories, and upload and download selected files. - Uploading Files with the File Manager
The files that a user uploads through the Web Forms File Manager are saved under the SessionID (or UserName) path. The uploaded files are copied from the client-side computer. - Downloading Files with the File Manager
Users can download any file listed in the right pane of the File Manager. The files are downloaded to the client-side computer from either the SessionID (UserName) or Common path on the server.