We recommend that you use the global context method GetTempFileName() for generating temporary file names. This method has the following advantages:
- The file name is unique.
- If the file is not deleted using 1C:Enterprise script tools, the platform deletes it on the next start.
Since the platform only deletes temporarily files when it is restarted, we recommend that you monitor their deletion. Otherwise, if a great number of temporary files is created, they might occupy a significant amout of disk space before the platform is restarted. Following this recommendation is especially important for script parts that are executed at server because the server usage schedule might not include regular restarts.
The lifetime of a server-based temporary file should not exceed the duration of a single server request because the next request might be directed to another physical server.
Also pay attention to algorithms that generate exceptions. In such algorithms creation and deletion of files must be performed within the Try-Except block.