Skip to content
Advertisement

Shared directory for file upload across subdomains on linux

I have a 2 modules that must share common directory for a specific uploaded files.

instructor.example.com And registrar.example.com

So what I want to know ,is what you guys do to make them have a common directory for the file uploads and where is it directory placed?

Because users from registrar.example.com must able to access the directory of the instructor users , specific directory of uploaded files.

For example name it “instructor_registrar/{instructor-id}/ cause I have OCD.

I already have made my research and I found 1 who has similar problem like mine but they just said “you can put it anywhere”. So I want to know where should I create the directory.

Advertisement

Answer

So I came up with an alternative. Here’s what I did. I have 2 framework in 1 subdomain.

JavaScript

I created another directory inside:

JavaScript

and set the privacy to 755

JavaScript

and also set the owner to root

sudo chown -R $USER:$USER /var/www/staff.example.com/uploads/shared_dir/ and set my $upload_path on file upload model to

JavaScript

because I need to create a personal directory if the user is new. I set all files inside /var/www/ owned by apache and all groups and users and enable read and write files for all members of www-data group to enable to make my mkdir() before uploading the file.

JavaScript

(I don’t recommend it but this is what I did)

JavaScript

That settles my file uploading outside the root or framework.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement