• 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

Robert F Schmitz

Well-known member
#3
Code:
How do I change the external data path from the default of data?
Edit the library/config.php file and add the following:
PHP:
$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
 

Mike

XenForo developer
Staff member
#4
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. :)
 

Brent W

Well-known member
#5
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.

So:

mediadomain.com

site1.com
site2.com
site3.com
site4.com
site5.com

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?
 

Jake Bunce

XenForo moderator
Staff member
#6
There are some config settings you can work with:

Code:
// 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.
 

Brent W

Well-known member
#8
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
 

Brent W

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

PHP:
$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?
 

Mike

XenForo developer
Staff member
#11
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);
 

Brent W

Well-known member
#12
PHP:
$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?
 

Mike

XenForo developer
Staff member
#13
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.
 

DeltaHF

Well-known member
#14
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?
 

D.O.A.

Well-known member
#15
PHP:
$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?
did you find a solution? I have the same problems.
[edit: fixed it]
 

Simon

Active member
#16
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?

Thanks