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. What about the possibility of a user cancelling an upload that''s currently in progress? Apologies if these questions are naive, but I''ve always taken web servers for granted so am very much a newb. Cheers, Mike
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 http://weblog.techno-weenie.net http://mephistoblog.com
On Thu, 2006-09-07 at 22:01 +0100, Mike Evans 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. > > What about the possibility of a user cancelling an upload that''s > currently in progress? > > Apologies if these questions are naive, but I''ve always taken web > servers for granted so am very much a newb.Nope, good question. Simples way is to write a very little handler you put in front that simple checks the CONTENT_LENGTH and then redirects. Then put it in front in a -S mongrel.conf: uri "/", :handler => AhabTheMobyFileKiller.new(:path => "/file/upload"), :in_front => true Or, you could modify the stock upload handler to take another parameter. Kick back the patch if you do, other folks will probably want that. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.