开发者

File Upload and cleanup with the Asp.Net Wizard control

I'm updating an existing page that makes use of the asp.net wizard control. I'm adding an optional step that will allow the user to upload a file.

I'm already past the first issue: I don't actually want to use the file until the wizard's finished button is selected, but I have to upload the file from the new step rather than the final step. That's no big deal. I just 开发者_JAVA技巧have an upload button on the page next to the control so you upload it in place. At this point I save it to App_Data folder and change the appearance of the wizard step to show there's an uploaded file (with an option to change it). There's also a custom validator control to make sure you finish that before moving on to the next step, but that's extra information.

The next issue is that I don't need or want these files around any more after I complete processing for the finish step, or if the user never gets that far. I can clean up the file okay after the finish step, or if the user decides to change to a new file, so I've solved most of this as well.

My problem is that I want a better way to clean up files when the user abandons the wizard after passing the new step but before clicking 'Finish'. I could do it in a batch app or on application start, but I'd rather keep the code all contained to the page with the wizard. Any ideas?


When the page loads, delete any files with a creation date older than a reasonable threshold. The threshold would depend on how long it takes the slowest possible user to complete the wizard.


Delete the files, based on time created, in a convenient page load event.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜