limit file download size

A

andreim

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
 
S

Shai Rosenfeld

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

Mariusz Pękala

--X3gaHHMYHkYqP6yf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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

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

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

--X3gaHHMYHkYqP6yf
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7-ecc0.1.6 (GNU/Linux)

iD8DBQFGsDBUsnU0scoWZKARAiK9AJ0fUKGZCmBQFRNX061uTaWNZruKBgCgzX4p
mIoJz2tQL9cGTysvG8T2d0g=
=7JHn
-----END PGP SIGNATURE-----

--X3gaHHMYHkYqP6yf--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,052
Members
48,769
Latest member
Clifft

Latest Threads

Top