Local File Operations
There may be cases where you need to perform local manipulations to temporary files (e.g. download a zip, extract its contents, and then upload them to WordPress). For these cases, you can use the system temp directory, which is the only local, writeable path on web servers on the VIP Platform.
A few things to keep in mind:
- UseÂ
get_temp_dir()
to find the right path. Or if you need to generate a temporary file, usewp_tempnam()
. - You should clean up and remove all local temporary files after they’re no longer needed, and before the process that created them terminates. UseÂ
unlink()
 to remove those files. - 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.
If you have any questions about the VIP Files Service or working with the filesystem on the VIP Platform, please don’t hesitate to get in touch with the VIP team so we can work with you on the implementation.