Feature #4493

Make destination folder for attachment uploads configurable

Added by Drazen Baic almost 8 years ago. Updated over 5 years ago.

Status:ClosedStart date:2009-12-28
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Attachments
Target version:-
Resolution:Duplicate

Description

Would it be possible to change app/models/attachment.rb in such a way, that the destination folder can be configured? Currently it is defined as

@@storage_path = "#{RAILS_ROOT}/files" 

This would be reasonable in Redmine deployments where one uses jruby and Redmine created as a JavaWebArchive with a Java application-server like Apache Tomcat. In this case the destination folder for the attachment uploads is a subfolder under $CATALINA_HOME/webapps/redmine.war/WEB-INF/files. The problem with this is that the uploaded files would disappear after deploying a new version of Redmine unless one copies the files to the #{RAILS_ROOT}/files directory before creating the WAR file.


Related issues

Duplicates Redmine - Feature #1236: Make destination folder for attachment uploads configurable Closed 2008-05-14
Duplicated by Redmine - Feature #2231: Ability to specify where files are stored on the filesystem Closed 2008-11-26

History

#1 Updated by Vinod Singh almost 8 years ago

+1

IMO having a separate directory for each project would be good. Our Redmine instance has > 5,000 attachment, which is increasing rapidly. Having so many files in single directory may become a probelm.

#2 Updated by Mischa The Evil almost 8 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Closed as a duplicate of #1236.

#3 Updated by vik pro over 5 years ago

def diskfile
#"#{@storage_path}/#{self.disk_filename}"
#"#{
@storage_path}/#{self.disk_filename}"
path = "#{self.storage_path}/#{self.project.identifier}/#{self.disk_filename}"
path_dir = "#{self.storage_path}/#{self.project.identifier}"
Dir.mkdir(path_dir) unless File.directory?(path_dir)
path

end

Make like that. in attachment.rb in app/model/

in configuration faile you can channge atchment_storage_path to you folder(example nfs on NAS) and all attachmet must be in one place on NAS

Also available in: Atom PDF