1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Attachment Storage Scheme

Discussion in 'XenForo Questions and Support' started by Brad L, Jul 7, 2011.

  1. Brad L

    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.
  2. Brogan

    Brogan 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 likes this.
  3. James

    James Well-Known Member

    Don't they technically contain 999 files, because the 1000th file would carry over to the next sub-directory :D
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Nit-picker ;)
    James likes this.
  5. Brad L

    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?
  6. James

    James 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.
    Brad L likes this.
  7. Brogan

    Brogan XenForo Moderator Staff Member


    The only time the user id is used is for avatars.
    Your user id is 616 and therefore your avatar is: http://xenforo.com/community/data/avatars/l/0/616.jpg
  8. trilogy33

    trilogy33 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?
  9. Brogan

    Brogan XenForo Moderator Staff Member

    That's correct.

    They're deleted the next time a cron cleanup task runs.
    trilogy33 likes this.

Share This Page