[Mongrel] Upload progress and limiting file sizes

Rick Olson technoweenie at gmail.com
Thu Sep 7 17:26:34 EDT 2006

On 9/7/06, Mike Evans <mike at harmonypark.net> wrote:
> Thanks to all concerned with the implementation of the Upload
> Progress plugin, it works really well.
> I want to limit the size of files to be uploaded to say 10Mb. Is
> there any way for Mongrel to 'refuse' to upload files over a certain
> size and then pass an error onto Rails in order to display feedback
> to the user? I don't really want to have to upload the whole file and
> then delete it if it's over the limit.

I don't know if this really belongs in upload progress, but it'd be a
trivial handler to write.  Might be better as a separate thing so that
you could lock down every request with a limit, or use on sites w/o
using upload_progress.

> What about the possibility of a user cancelling an upload that's
> currently in progress?

Cancelling the current browser request works.  Try calling .stop() on
the iframe object.

Rick Olson

More information about the Mongrel-users mailing list