option to set maximum size of uploaded files
git-svn-id: http://redmine.rubyforge.org/svn/trunk@131 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ff65a5b22a
commit
6487c1803f
|
@ -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
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<%= start_form_tag ({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :class => "tabular") %>
|
||||
<p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>
|
||||
<%= link_to_function image_tag('add'), "addFileField()" %></label>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %></p>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= human_size(Attachment.max_size) %>)</em></p>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<%= end_form_tag %>
|
||||
<% end %>
|
||||
|
|
|
@ -89,7 +89,7 @@ end %>
|
|||
<%= start_form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true, :class => "tabular") %>
|
||||
<p id="attachments_p"><label><%=l(:label_attachment_new)%>
|
||||
<%= link_to_function image_tag('add'), "addFileField()" %></label>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %></p>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= human_size(Attachment.max_size) %>)</em></p>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<%= end_form_tag %>
|
||||
<% end %>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="box">
|
||||
<p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>
|
||||
<%= link_to_function image_tag('add'), "addFileField()" %></label>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %></p>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= human_size(Attachment.max_size) %>)</em></p>
|
||||
</div>
|
||||
|
||||
<%= submit_tag l(:button_create) %>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>
|
||||
<%= link_to_function image_tag('add'), "addFileField()" %></label>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %></p>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= human_size(Attachment.max_size) %>)</em></p>
|
||||
</div>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<%= end_form_tag %>
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>
|
||||
<%= link_to_function image_tag('add'), "addFileField()" %></label>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %></p>
|
||||
<%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= human_size(Attachment.max_size) %>)</em></p>
|
||||
|
||||
</div>
|
||||
<!--[eoform:issue]-->
|
||||
|
|
|
@ -63,3 +63,7 @@
|
|||
# Textile formatting is automativaly disabled if RedCloth is not available
|
||||
# Set to true to manually disable.
|
||||
# $RDM_TEXTILE_DISABLED = true
|
||||
|
||||
# Maximum size for attachments (in bytes)
|
||||
# Default to 5 MB
|
||||
# $RDM_ATTACHMENT_MAX_SIZE = 5*1024*1024
|
||||
|
|
|
@ -295,6 +295,7 @@ label_modified: geändert
|
|||
label_deleted: gelöscht
|
||||
label_latest_revision: Neueste Neuausgabe
|
||||
label_view_revisions: Die Neuausgaben ansehen
|
||||
label_max_size: Maximale Größe
|
||||
|
||||
button_login: Einloggen
|
||||
button_submit: Einreichen
|
||||
|
|
|
@ -295,6 +295,7 @@ label_modified: modified
|
|||
label_deleted: deleted
|
||||
label_latest_revision: Latest revision
|
||||
label_view_revisions: View revisions
|
||||
label_max_size: Maximum size
|
||||
|
||||
button_login: Login
|
||||
button_submit: Submit
|
||||
|
|
|
@ -295,6 +295,7 @@ label_modified: modificado
|
|||
label_deleted: suprimido
|
||||
label_latest_revision: La revisión más última
|
||||
label_view_revisions: Ver las revisiones
|
||||
label_max_size: Tamaño máximo
|
||||
|
||||
button_login: Conexión
|
||||
button_submit: Someter
|
||||
|
|
|
@ -296,6 +296,7 @@ label_modified: modifié
|
|||
label_deleted: supprimé
|
||||
label_latest_revision: Dernière révision
|
||||
label_view_revisions: Voir les révisions
|
||||
label_max_size: Taille maximale
|
||||
|
||||
button_login: Connexion
|
||||
button_submit: Soumettre
|
||||
|
|
Loading…
Reference in New Issue