Possible to change Default location for Attachments?

Hi,

Due to some space issues, I have mounted additional space on system. Now I wanted to change the default location for attachments from “/home/frappe/frappe-bench/sites/site1.local/public/files/” to the mounted space.
Is that possible?

Thanks,

T.H

1 Like

Hello @Talha-Hashmi

Please change path in this file.

@bhavikpatel7023 made changes to the file but no effects.thanks

Could you share your changes?

1 Like

@bhavikpatel7023

I made changes in file = /home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py

if frappe.db.exists(‘File’, {‘name’: self.name, ‘is_folder’: 0}):
old_file_url = self.file_url
if not self.is_folder and (self.is_private != self.db_get(‘is_private’)):
private_files = frappe.get_site_path(‘private’, ‘files’)
public_files = frappe.get_site_path(‘public’, ‘files’)

                            if not self.is_private:
                                    shutil.move(os.path.join(private_files, self.file_name),
                                            os.path.join(public_files, self.file_name))

                                    self.file_url = "/files/{0}".format(self.file_name)

                            else:
                                    shutil.move(os.path.join(public_files, self.file_name),
                                            os.path.join(private_files, self.file_name))

                                    self.file_url = "/private/files/{0}".format(self.file_name)

added my location in

" self.file_url = “/files/{0}”.format(self.file_name)"

and “self.file_url = “/private/files/{0}”.format(self.file_name)”