On 01 Mar 2007, at 16:49, Eric Northam wrote:
> I''ve been playing around with attachment_fu for uploading images
and
> discovered that it seems to handle the max size very strangely. It
> appears that the max size is checked after the image is resized. So
> you can upload a gigabyte file, attachment_fu then resizes it and
> determines that it meets the size requirements.
This is the best way to handle it from my point of view. The file has
been uploaded, so it''s there on your server anyway. You could check
the filesize using attachment_fu''s before callback before letting the
plugin do its resizing job.
> Is there a way to limit the size of the upload? Ideally this would
> occur before loading the whole gigabyte into memory.
In this case, I would strongly advise you to use a clientside
filesize check before letting them upload.
This is one of the reasons I really like to use SWFUpload for the
uploading of files (although it has some quirks you have to take into
account when integrating it in a rails application), you can
effectively limit the filesize AND the types of files, as well as
allow multiple file selection in the dialog and it does it in a
splendid user friendly way. Add to that you can easily use it for
having upload progress and (because it creates its own connection to
your webserver) make it look as if the upload is "ajax''ed".
From all
of the ajax upload workarounds, this one has pleased me the most.
Best regards
Peter De Berdt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---