diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-01-01 12:09:09 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-01-01 12:09:09 +0000 |
commit | 6487c1803fa947f73c4667bb10f762a98487aa1b (patch) | |
tree | b4fc8295773fff6bde8aa060d2a8536b4cffc3e0 /app/models/attachment.rb | |
parent | ff65a5b22a5441476320a461c986a64b84ee025a (diff) | |
download | redmine-6487c1803fa947f73c4667bb10f762a98487aa1b.tar.gz redmine-6487c1803fa947f73c4667bb10f762a98487aa1b.zip |
option to set maximum size of uploaded files
git-svn-id: http://redmine.rubyforge.org/svn/trunk@131 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/attachment.rb')
-rw-r--r-- | app/models/attachment.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb index aca86cec5..cdf5a3e47 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -21,8 +21,12 @@ class Attachment < ActiveRecord::Base belongs_to :container, :polymorphic => true
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
+ @@max_size = $RDM_ATTACHMENT_MAX_SIZE || 5*1024*1024
+ cattr_reader :max_size
+
validates_presence_of :container, :filename
-
+ validates_inclusion_of :filesize, :in => 1..@@max_size
+
def file=(incomming_file)
unless incomming_file.nil?
@temp_file = incomming_file
|