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

XF 1.1 Attachment locations

Discussion in 'XenForo Questions and Support' started by Robert F Schmitz, Dec 3, 2011.

  1. Robert F Schmitz

    Robert F Schmitz Well-Known Member

    Is it possible to store attachments somewhere other than the hosting server? I have limited space but more on other servers.
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. Robert F Schmitz

    Robert F Schmitz Well-Known Member

    How do I change the external data path from the default of data?
    Edit the library/config.php file and add the following:
    $config['externalDataPath'] = 'new_external_data_path';
    $config['externalDataUrl'] = 'new_external_data_url';
    Change the paths to suit. Note that the path is a file path (it can be relative to the installation path) and the URL is how the data will be loaded by users. These values need to point to corresponding locations.
    What would this _path and _url look like? I imagine that it depends obviously on where it is being directed to. I want to utilize server space on another server. Would _url be what they call the physical address?

    _path be the absolute hosting path? such as /home/content/file_directory
    _url be the domain without anything else? such as w w w.myotherdomain.com
  4. Mike

    Mike XenForo Developer Staff Member

    It's theoretically possible, but it's really not simple -- if you have limited space available, then I assume you're on shared hosting, and it definitely wouldn't be possible there. :)
    Rob Fritz likes this.
  5. BamaStangGuy

    BamaStangGuy Well-Known Member

    Bump. This is something I was looking into but for separate reasons. I run multiple forums and use one domain for my network. I want all attachments to be served from this one domain name for all of my forums.




    All site_.com domains would have a folder under mediadomain.com that would serve attachments and the url for the attachments would be under mediadomain.com.

    Is this currently possible?
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There are some config settings you can work with:

    // PATH FOR internal_data DIRECTORY
    $config['internalDataPath'] = 'internal_data';
     * Relative path to the thumbnails / avatars (etc.) directory from the base installation directory.
     * Must be web accessible and server-writable.
     * Examples 'data', 'foo/bar/data', '../path/to/thingy'.
     * @var string
    $config['externalDataPath'] = 'data';
     * URL to the thumbnails /avatars (etc.) directory. Can be relative or absolute, but must
     * point to the web-accessible location referred-to by $externalDataPath.
     * @var string
    $config['externalDataUrl'] = 'data';
    These can be added to library/config.php. But if you want to store files on a different server (ie not a local path) then it requires some doing.
    BamaStangGuy likes this.
  7. BamaStangGuy

    BamaStangGuy Well-Known Member

  8. BamaStangGuy

    BamaStangGuy Well-Known Member

    Since internal path is relative how do I go back out to a directory?

    For example xenforo is installed in /home/da/www/
    I want internal path to be /usr/local/apache2/htdocs/xenforo/data/da
  9. Mike

    Mike XenForo Developer Staff Member

    ../ goes up a directory.
  10. BamaStangGuy

    BamaStangGuy Well-Known Member

    I don't seem to be doing it right or something. I should have to go back three directories, correct? So should it be:

    $config['internalDataPath'] = '../../../usr/local/apache2/xenforo/data/da';
    That doesn't work. I have tried less and more. All I get is a white page on the site. Any ideas?
  11. Mike

    Mike XenForo Developer Staff Member

    Actually, looking at the code, you can just use an absolute path and it should work. If it doesn't, there may be some other issues triggering it.

    You may want to try turning on display_errors in your config.php if you get a blank page: ini_set('display_errors', true);
  12. BamaStangGuy

    BamaStangGuy Well-Known Member

    $config['internalDataPath'] = 'usr/local/apache2/xenforo/data/da';
    $config['internalDataPath'] = '/usr/local/apache2/xenforo/data/da';
    Neither of these work as well. I set display_errors to true but still just got a blank white page across the entire site.

    Any other ideas?
  13. Mike

    Mike XenForo Developer Staff Member

    If you want to submit a ticket, I can look into it. Though based on your path, I'm guessing that I'd need root SSH access to check what's going on? Though FTP access to the XF files would probably suffice for debugging, but may not allow me to fix it.
  14. DeltaHF

    DeltaHF Well-Known Member

    For large sites, it would be great to have the option to store attachments on S3.

    I was just researching the options...would mounting a drive using S3FS, then directing attachments to be stored there, work?
    BamaStangGuy likes this.
  15. D.O.A.

    D.O.A. Well-Known Member

    did you find a solution? I have the same problems.
    [edit: fixed it]
  16. Simon

    Simon Active Member

    Has anyone got an example of how to store attachments on another server?

    I know I can store them in another domain on the same server. I wish to serve them from a sub domain on another server.

    Any Ideas?

    DeltaHF likes this.

Share This Page