PHP filesystem best practice

I'm writing a PHP script which communicates with another program via files. I wonder if there is some policy or standard on where to put such files? I assume choosing a path like C:\foo\bar\ isn't the best? If nothing else it's not portable.

Would $_SERVER['HOME'] be a good place or is there something more appropriate? The temp folder is not good as the files technically aren't temporary. For a Windows application I think you would typically use %appdata%\\{company name}\\{app name} but that's obviously not that great for PHP. • I would imagine $_SERVER['HOME'] is not a good idea because the other app is probably not going to have access to the same variable. – MonkeyZeus Jul 2 '15 at 16:13

Typically the right place for a file exchange folder would be outside of the webroot where both web applications have access to. So it's anywhere, except where other files reside.

Files will generally be FTP'ed or SFTP'ed (FTP over SSH) to the server, or share the same folder on the host if they are served from the same machine (actual machine or VM).

Make sure that you remove the files after they have served their usefulness. Last thing you want is a big bulk of files in a folder that you will never (ever) use again...

Hope it helps