Transactional Uploads offer the following important advantages:
Most upload applications log the upload into a database. 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.
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.
This synchronization is available only with databases that provide transaction support via COM+, such as Microsoft SQL Server or Oracle. |
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 example:
BeginTransactionTraditional ASP code for uploading does not allow this. Every action must be verified, such as:
fileUpload.FormEx("file1").Save
|
This leads to code that is either difficult to read, or has incomplete or incorrect error checking. FileUp's transactional upload capability simplifies the problem significantly, as all file upload operations will complete successfully or roll back to the pre-transaction state. This ensures that when a user uploads multiple files, all of the uploaded files are written to the web server's hard disk, or no files are written at all. Best of all, the resulting code is very easy to read, yet has complete error handling.
<%@ language="vbscript" TRANSACTION="Required" %>
|