XF 2.2 Is there a best practice to cache files?


Fellow developers,

my addon needs to generate multiple sizes for each picture attachment uploaded to the forum. Is there a default folder where this kind of cache files should be stored?

Maybe /data/my_addon or something similar?


R. Campos.

Chris D

XenForo developer
Staff member
If the files need to be web accessible then, yes, anywhere in the data directory will be fine. If the files should not be directly web accessible, then use internal_data.

data and internal_data are the only two directories we can guarantee will be writable.

For file system operations, ensure you're using the abstracted file system (see various examples in the XF code) as this allows customers to host the contents of their data or internal_data directories remotely.