[Zope] Checking files to upload

Juan Manuel Ruiz Garcia juanm_ruiz@yahoo.es
Sun, 6 Oct 2002 12:35:04 +0200


That is what I was trying but I get an error...

Error Type: AttributeError
Error Value: getsize

The new code is this one, sure I'm doing something more wrong...
I've tried also with fileToUpload.seek(0) before getsize(), but get the same
error

----
id=context.REQUEST.form['id']
descr=context.REQUEST.form['desc']
fileToUpload=context.REQUEST.form['file']
fileToUpload.getsize()

context.manage_addFile(id,fileToUpload,descr)

---

-----Mensaje original-----
De: robert [mailto:robert@redcor.ch]
Enviado el: sábado, 05 de octubre de 2002 17:42
Para: Juan Manuel Ruiz Garcia
CC: zope@zope.org
Asunto: Re: [Zope] Checking files to upload


you can ask for its size by

fileToUpload.getsize()
mabe you have to do a fileToUpload.seek(0)
beforehand.

Robert



Juan Manuel Ruiz Garcia wrote:

>Hi,
>
>I want to check selected files for upload before.  My script is this one:
>
>-------------------
>id=context.REQUEST.form['id']
>descr=context.REQUEST.form['desc']
>fileToUpload=context.REQUEST.form['file']
>context.manage_addFile(id,fileToUpload,descr)
>-------------------
>
>The point is that, if I enter a non-existing file in the "file" input field
>in the form that calls this script, this code creates a zero-bytes files,
>instead of warning me... how can I change this code to detect "file not
>found error"?
>
>Working with Zope 2.3 (Python 1.5)
>
>Thanks,
>
>
>
>_______________________________________________________________
>Copa del Mundo de la FIFA 2002
>El único lugar de Internet con vídeos de los 64 partidos.
>¡Apúntante ya! en http://fifaworldcup.yahoo.com/fc/es/
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>
>
>
>

_______________________________________________________________
Yahoo! Messenger
Nueva versión: Webcam, voz, y mucho más ¡Gratis! 
Descárgalo ya desde http://messenger.yahoo.es