[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

limit file download size

andreim

7/29/2007 8:32:00 PM

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

4 Answers

Gregory Brown

7/30/2007 2:28:00 AM

0

On 7/29/07, andreim <andreim@gmail.com> wrote:
> Hi, I'm writing a ruby on rails application

http://groups.google.com/group/rubyon...

Shai Rosenfeld

7/31/2007 8:05:00 AM

0

anyone know how to notify the user, client side, that the upload is too
big??

--
Posted via http://www.ruby-....

Mariusz Pekala

8/1/2007 7:07:00 AM

0

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>
:-)

--
No virus found in this outgoing message.
Checked by 'grep -i virus $MESSAGE'
Trust me.

Gregory Brown

8/1/2007 7:54:00 PM

0

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/rubyon...