Member variable HttpUploadedFile():IsOnDisk Foundation
Specifies whether the file is stored on disk.
The member variable :IsOnDisk specifies whether the file was saved to the web server’s hard disk during the upload process or if it only exists in memory. If :IsOnDisk is .T. (true), the file is disk-based. ln this case, the :NameOnDisk member variable contains the full pathname of the file. If .F. is assigned to :IsOnDisk, the file only exists in memory.
For further details on how to configure uploaded file management, please refer to Global in this documentation.
The following example demonstrates an efficient way to receive files where it is not feasible to hold the file content in memory. Receiving files where the file size is expected to be more then several Megabyte or Gigabyte is an example for such a case.
Assume the configuration file global.config contains the following XML fragment, which configures <CXP/> to store uploaded files on the web server’s harddisk:
The following code is an excerpt from the <CXP/> page which processes the uploaded file. Because the file is known to reside on disk, the code just associates the file’s pathname with a unique id for later retrieval. In this example, this is the id of the customer (CID) currently selected, which is read from session variable. This approach prevents the file from being loaded into memory, which is what would have occurred if the file was accessed via the member variable :Data. Instead, dedicated code can be written for processing the file at a later stage, if needed. Successively reading in chunks of data using the file functions makes it unnecessary to keep the whole file in memory, for insstance.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.