Basically, a user comes into a form with a single text box and they can upload a batch of comma-delimited transactions. Once they hit submit, the app inserts a row into a SQL Server table containing their pertinent information, effectively locking the screen out from everyone else while the batch is being processed.
That information is then used to build a header for the user's file via bcp SQL (in a *.cmd) on the server. Then, the page copies the file from their PC to the server, where it is concatenated with the header. Then, it's sent up to the mainframe.
The problem is the copy step. Often a user will upload thousands of transactions at once and, depending on the server's CPU load at the time, the script may timeout, even though we have it set at a timeout of 30 minutes. If the script times out, we want to call a procedure to delete their file on the server and delete the SQL Server row.