Web app temp files

Web apps seem to use the system’s default temporary file location for the account that launched the app.

When large files are uploaded into a web app, a temporary file is created and grows as the file is uploaded, and then, when the file is completely uploaded, the app is able to process it and do whatever it wants with it (writing it to a new location or just reading some data from it or whatever).

This leads to two questions:

  1. Is there any to change where the temporary files are written? This app is on a server with a small (20GB) boot disk, and users are uploading 2-10GB video files. Just a few uploads fill the boot disk with temp files.

  2. At what point is a ‘temporary’ file deleted by a web app in the temp folder? Should they be deleted when all references to the file destroyed? I’m seeing the system-generated temporary files sticking around long after their references are gone and even after the app is cleanly shut down. I clean up the files I’ve created, but now I’m thinking I may need to add my own sweeper of some sort to clean up files that I didn’t even create myself.

Any thoughts appreciated!

You could try changing where the users temp directory is in the OS.

If you’re using webfileuploader, the files are presented to you when they arrive and should be deleted when the event completes. If they are not, then the app probably can’t delete them for some reason.