Andreas, I used what you recommended but now when I try to view the uploaded file it comes up blank. Is there a step that I am not doing? spaceAvail = context.Availability() data = file.read() fileSize = len(data) fileSize = (fileSize/1024)/1024 if spaceAvail < 80: if fileSize < 30: sizeTest = context.getDirectories('/var/www/html/da') if sizeTest > 900: message = 'Failure: No available disk space, see system administrator' return ('failure', new_context,{'portal_status_message':message}) else: test = new_context.manage_editPloneExternalFile(title = title,file = file,REQUEST = REQUEST) if not test: return ('success', new_context,{'portal_status_message':context.REQUEST.get('portal_status_ message', 'Content updated.')}) else: return ('failure', new_context,{'portal_status_message':test}) else: errormsg = 'Failure: File exceeds size limitation of 30MB' return ('failure', new_context,{'portal_status_message':fileSize}) else: errormsg2 = 'Failure: No disk space available in /var directory' return ('failure', new_context,{'portal_status_message':errormsg2}) Thank You, Laura -----Original Message----- From: Andreas Jung [mailto:lists@andreas-jung.com] Sent: Monday, November 08, 2004 11:16 AM To: Laura McCord; zope@zope.org Subject: Re: [Zope] Python question --On Montag, 8. November 2004 11:10 Uhr -0600 Laura McCord <Laura.McCord@doucet-austin.com> wrote:
I am writing a Python Script and I am trying to get the size of an uploaded file. Does anyone know what I should use? I thought that I could use len() but I was getting an error using it.
data = uploaded_file.read() print len(data) *must* work. -aj
--On Dienstag, 9. November 2004 9:21 Uhr -0600 Laura McCord <Laura.McCord@doucet-austin.com> wrote:
From: Laura McCord <Laura.McCord@doucet-austin.com> To: Andreas Jung <lists@andreas-jung.com>, zope@zope.org Subject: RE: [Zope] Python question Date-Sent: Dienstag, 9. November 2004 16:21 Uhr
Andreas,
I used what you recommended but now when I try to view the uploaded file it comes up blank. Is there a step that I am not doing? errormsg = 'Failure: File exceeds size limitation of 30MB'
This looks like some upload limit in ExtFile or whatever. At least this is not coming from Zope and not from Plone. -aj
participants (2)
-
Andreas Jung -
Laura McCord