Transactional Processing
The examples in this section demonstrate a key new feature of SA-FileUp:
Transactional uploads.
Most upload applications log the upload into a database.
Prior to SA-FileUp 3.0, there was no synchronization between database and file operations.
Typically, an upload is processed and a file is written to the web server's hard disk.
After an upload is complete, a database insert is performed to log the uploaded file.
However, what happens if the database operation fails, due to a validation error for example?
The uploaded file is left orphaned on the disk, with no corresponding database entry.
SA-FileUp solves this problem by automatically synchronizing the upload processing with the
database transaction. If the database transaction rolls back, the upload is rolled back
automatically as well, so no orphaned files are left on disk.
Similarly, if the upload fails for any reason, such as permissions problems or because of insufficient disk space,
the database transaction is aborted. Your uploaded files and database entries
are always synchronized.
When using a database, it is very easy to combine a sequence of steps into a transaction.
The programmer can be sure that all the steps will either execute successfully, or roll back to
the pre-transaction state.
For examples of using transactional uploads, see the following examples:
Uploading with a Transaction
Uploading to a Database Transaction