|
Instead of relying on the file system for storing and retrieving files, you may decide to use a database instead. Using the ActiveFile File object, you can store and retrieve files from any database that supports ADO access to BLOBs (Binary Large OBjects). Database Topics
|
|
The first step in using your database to import and export files is to make sure you can access it using Active Data Objects (ADO) from your Active Server Pages. You will want to refer to the Active Server Pages documentation for help on using ADO. However, if you are using the default ODBC provider interface here are a few quick tips:
The next step is to make sure that the database column that you wish to use to import and export from is defined properly. ActiveFile can only import and export from database columns that Active Data Objects (ADO) understands as adLongVarBinary. Here are some example native datatypes that work:
For help on determining the correct native datatype for other databases, consult the database design documentation for that database.
|
|
Importing files involves storing the data from a file into the BLOB field of a database record that can be accessed through ADO. The steps to perform an import are simple:
The following shows a complete example of how to store an uploaded file and the name of the submitter into a database:
For a more complete example, take a look at the ActiveFile Database Explorer sample application that demonstrates both importing and exporting files from a Microsoft Access database.
|
|
Exporting files involves retrieving the data a BLOB field of a database record that can be accessed through ADO and writing it out to a file. The steps to perform an export are simple:
The following shows a complete example of how to export a file and download it to the client:
For a more complete example, take a look at the ActiveFile Database Explorer sample application that demonstrates both importing and exporting files from a Microsoft Access database.
|