Displaying 5 results from an estimated 5 matches for "validates_filesize_of".
2006 Apr 25
3
limiting options in file_upload
Does anyone know if it''s possible to set constraints to the size & type of file that file_column will accept?
I''d like to limit to image files of less than 2MB.
If this isn''t possible with file_column, is there a graceful way of getting the controller to handle it?
thanks
dorian
--
--
I do things for love or money
2006 Jan 11
1
fiile_column persistent across different forms
...<%= image_tag url_for_file_column("post", "image") %>
<br><br
<% end %>
and in my model i do
file_column :image, :magick => { :geometry => "320x240" }
validates_file_format_of :image, :in => ["image/jpeg"]
validates_filesize_of :image, :in => 0.kilobytes..50.kilobytes
does anybody see what I am missing here ?
thanks
adam
2006 May 29
3
File.size() on Uploaded Images Fail
...ils on this line for
images...
end
The error I get is: "can''t convert StringIO into String"
I''m sure there''s an easier method/property to get the file size of the
uploaded file. Like, reading the HTTP headers?
How do they get the file size in the validator?
validates_filesize_of :field, :in => 15.kilobytes..1.megabyte
Thanks for any leads,
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060529/e9214f59/attachment.html
2007 Feb 01
2
file_column 2nd try....
...Base
##attr_accessor :text
def do_work(args)
##@text = args[:text]
@image = Image.new(args[:image])
@image.dimensions
@image.save
end
def progress
results[:progress]
end
end
ImageWorker.register
image.rb
require ''RMagick''
class Image < ActiveRecord::Base
belongs_to :user
validates_filesize_of :image, :in => 15.kilobytes..1.megabyte
validates_file_format_of :image, :in => ["gif", "png", "jpg"]
file_column :image, :magick => {:versions => {"thumb" => "150x100",
"picture" => "600x450>"}}
def dimen...
2005 Dec 26
1
file_column + restrictions
Hey All. Season''s Greetings.
Can anyone here elaborate on how one can restrict the size of image
uploads using file_column/rmagick? I''d like to be able to, in my
controller/model, check the size of an uploaded image, and if it''s size
on disk exceeds x amount, I''d like to indicate to the user that this is
a no-go and kill the temp file.
Any ideas?
Thanks