Project

General

Profile

modifying file upload in files using attachment_fu plugin

Added by tendou souji over 16 years ago

Hi im currently testing out redmine to use attachment_fu plugin so i can store the uploaded files to s3 but the problem is i can't make it work even locally, i've successfully installed the plugins and i've made some dummy forms to test the plugin and it works, now im applying it to the real application here's the code I altered in attachment.rb

class Attachment < ActiveRecord::Base
belongs_to :container, :polymorphic => true
belongs_to :author, :class_name => "User", :foreign_key => "author_id"

validates_presence_of :container, :filename, :author
validates_length_of :filename, :maximum => 255
validates_length_of :disk_filename, :maximum => 255
acts_as_event :title => :filename,
:url => Proc.new {|o| {:controller => 'attachments', :action => 'download', :id => o.id}}
cattr_accessor :storage_path
@@storage_path = "#{RAILS_ROOT}/files"
has_attachment  :content_type => :image,
:path_prefix => "#{RAILS_ROOT}/files",
:storage => :file_system,
:partition => :false,
:max_size => 500.kilobytes

but somehow it doesnt write the actual file on the storage path.

Hope someone can share some opinion on this

Thanks