Attachment Storage Scheme

Brad L

Well-known member
How exactly are attachments stored in the filesystem? Does each member have their own directory like vbulletin, or are there shared directories? I have a xenforo forum under development, and the few existing members' attachments are all located here:

I realized earlier today that my file permissions for the data and internal_data directories were incorrect, so I'm not sure if this is intended behavior or an effect related to the incorrect permissions.


XenForo moderator
Staff member
There is one main directory, with sub-directories containing 1000 files.

The /data/attachments directory is for the thumbnails.
The /internal_data/attachments directory is for the original images. This directory is php protected which enables the contents to be restricted to certain groups/users using the permission: View attachments to posts.

Brad L

Well-known member
Thanks for the quick replies. Are you two saying that the folder names (/internal_data/attachments/0/) have nothing to do with a member's userid?


Well-known member
The 0 is the group they belong to. The first 999 attachments will have /0/, then 1000-1999 will have /1/, then 2000-2999 will have /2/, etc.


Well-known member
When a post is permanently deleted, any attachments within get removed from the server too right?
I thought this was the case as to not leave orphan files everywhere?