Limit Photo Size on Upload

Sivakatirswami katir at hindu.org
Fri Nov 6 00:12:34 EST 2009


Thanks to Sarah's wonderful example I'm building a little photo uploader.
( I don't understand all the parsing of the multipart form data, 
exactly, but enough to customize
for my needs...)

I'm worried about abuse... maybe too paranoid... I don't know, but I 
would like to limit file size of uploads to 2.5 MB photos.

When do we do that?  I don't think a file browser
(  <input name="image" type="file" size="25" />) knows how big the file 
is to actually stop the upload...

so you have to handle it *after* receiving the post, right?

if $_POST_RAW is not empty then
# includes headers and filename and caption of course but no need be too 
precise
 
  if len($_POST_RAW) > 2636822 then
 
  # exit out of processing the post
  # and return some response to the user "File Too Big."

have I got this right?







More information about the use-livecode mailing list