Forum: Ruby limit file download size

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1d7d0a1c0aabf7d358d318c3426c6bf1?d=identicon&s=25 andreim (Guest)
on 2007-07-29 22:36
(Received via mailing list)
Hi, I'm writing a ruby on rails application that allows the user to
submit a link of a file which my app will then download.
Right now my app blindly downloads the file (which is 1-2mb on
average)
I'm worried about pranksters who would intentionally submit links to
30gb files.
Is there a way to set the maximum size of a file that I'm downloading?

One possible solution is to parse the content-length field of the file
header. But the server need not send this field along with the file.

I just want my application to stop downloading when the file gets to a
certain size (say 2mb) and alert the user that the file they submitted
is too big.

Thanks!

--Andrei
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2007-07-30 04:28
(Received via mailing list)
On 7/29/07, andreim <andreim@gmail.com> wrote:
> Hi, I'm writing a ruby on rails application

http://groups.google.com/group/rubyonrails-talk
4c3acdc3d93f54cc7a7281780ec8a4ee?d=identicon&s=25 Shai Rosenfeld (shai)
on 2007-07-31 10:05
anyone know how to notify the user, client side, that the upload is too
big??
Bd4166a8d561763cd47294e6265d8bca?d=identicon&s=25 Mariusz Pękala (Guest)
on 2007-08-01 09:08
(Received via mailing list)
On 2007-07-31 17:05:24 +0900 (Tue, Jul), Shai Rosenfeld wrote:
> anyone know how to notify the user, client side, that the upload is too
> big??
>

I recall there was some magic hidden field - google
for 'upload form max_file_size'

Other than that, you can always put:
<p>Please, don't upload files bigger than X kb</p>
:-)
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2007-08-01 21:55
(Received via mailing list)
On 7/31/07, Shai Rosenfeld <shaiguitar@gmail.com> wrote:
> anyone know how to notify the user, client side, that the upload is too
> big??

http://groups.google.com/group/rubyonrails-talk
This topic is locked and can not be replied to.