Attachment_fu and Size Issue

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.

Is there a way to limit the size of the upload? Ideally this would
occur before loading the whole gigabyte into memory.

Eric

On 01 Mar 2007, at 16:49, Eric N. 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

I agree. It’s a much better user expierence to check the size before
uploading. You wouldn’t happen to know if there is a rails example out
there with SWFUpload?

Thanks,

Eric