Skip to content

Working with the /tmp directory

The system temp directory (/tmp) is a local, writeable path on an application’s web servers on the VIP Platform. The /tmp directory is most commonly used to perform local manipulations to temporary files. For example, downloading a *.zip archive to /tmp, extracting its contents, then uploading the contents to the WordPress site’s /uploads/ directory on the VIP File System.

All filesystem functions will work as expected in /tmp, including directory traversal.


  • Use get_temp_dir() to determine the correct, writable directory path for temporary files.
  • If a temporary file needs to be generated, use wp_tempnam().
  • Use unlink() to clean up and remove all local temporary files after they are no longer needed. Be sure to remove the files before the process that created them terminates.
  • Files and directories can only be relied on for the duration of the current request.
    • Each request may be served by a different container and the sequence of requests from a given user are not guaranteed to be served by the same container.
    • Containers are transient and may be created and destroyed due to autoscaling.

Last updated: August 03, 2023

Relevant to

  • WordPress