I forgot to mention, I'm not uploading the file into Plone, I'm
actually FTPing it over to a different server with enough storage and
bandwidth to deal with all these files.
On Apr 9, 2007, at 3:47 PM, Brett Kennedy wrote:
> I believe the PloneExFile product can do that. It may be another plone
> product and I may have them mixed up though. One of them in any case :)
> -----Original Message-----
> From: plone-users-bounces@...
> [mailto:plone-users-bounces@...] On Behalf Of Valerie
> Sent: April 9, 2007 3:31 PM
> To: plone-users@...
> Subject: [Plone-Users] Validating the file size on a file upload
> withoutfully loading the file into memory
> I have a Zope controller template form that has a file upload field in
> it. I need to limit the file to be uploaded for 5MB maximum, and
> validate based on that.
> However (please correct me if I'm wrong), based on the behavior of the
> validation script, the validation code I have loads the file into the
> server's memory (I think?), then checks the file size, and returns
> based on that.
> Now, that's not a problem if the file is under 5MB, but if a user were
> to try to upload a huge file, the validation code takes forever to
> return, and if the file was really big, I would assume the server would
> start having problems.
> My validation code:
> req = context.REQUEST
> if file_upload:
> file_upload.seek(0, 2)
> size = file_upload.tell()
> if size > 5242880:
> state.setError('file_upload', 'The maximum size of a file upload
> I also tried setting the cgi-maxlen directive in zope.conf to 7MB (the
> 5MB file limit plus an extra 2MB just in case), but while the site does
> return a Maximum Size Exceeded error for the form when I upload
> something bigger than 7MB, it also seems to take the time to read the
> entire file, then return the error (I tested this with a 100MB file,
> which took a good 2 minutes to process).
> Is there any way to only load enough of the file into the server's
> memory (just over 5MB or less) for validation purposes? Or am I just
> stuck if someone tries to upload a 1GB file?
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> opinions on IT & business topics through brief surveys-and earn cash
> Plone-Users mailing list