For *nix operating systems the
Filesystem Hierarchy Standard provides widely accepted guidelines to help you select the right directory for where to store files.
/tmp is considered volatile so once you
close a file it can be removed by the system, e.g. upon reboot
/var/tmp is less volatile,
you are supposed to remove any temporary files yourselves whenever you feel they are not needed anymore.