Forums / Developer / How to create an unique temporary file?

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

How to create an unique temporary file?

Author Message

Jerome Despatis

Friday 01 July 2011 5:59:24 am

Is there in eZ API a magic function to do that ?

for now I use tempnam('/tmp', ...)

=> I guess /tmp is not the appropriate place to put the file... Maybe eZSys::varDirectory() is *the* place to use?

=> a better function than tempnam ? maybe better to use eZClusterFileHandler?

Thanks for your help

Jérôme Vieilledent

Friday 01 July 2011 6:29:30 am

Hi Jerome

It's actually up to you and what you need. If your temporary file needs to be used by several servers, then you indeed must use eZClusterFileHandler API.

If not, I'd better chosse the eZSys::varDirectory() approach you mention :). Don't forget to delete your temp file once you don't need it anymore !

Jerome Despatis

Friday 01 July 2011 6:43:43 am

Ok I understand

thanks