Thanks Frank,
 I'll try that,
 
 Stéphane

----- Message d'origine ----
De : Frank Burkhardt <[EMAIL PROTECTED]>
À : Stéphane Brault <[EMAIL PROTECTED]>; zope3-users@zope.org
Envoyé le : Mardi, 20 Juin 2006, 12h40mn 23s
Objet : Re: Re : Re : [Zope3-Users] Uploading files

Hi,

On Tue, Jun 20, 2006 at 10:10:52AM +0000, Stéphane Brault wrote:
> Hi all,
>  I'm sorry to bother you with what must be a simple problem but I still can't 
> see
>  how to upload files with zope 3. If ajax is not a good way to go, how should 
> I go ?
>  I just need that to upload csv files which I parse to update my database 
> (MySQL) and
>  to upload image files.

You could use the Bytes() -schema whose InputWidget is a file upload field by 
default.
The content class or adapter for your form should look like this:

class IMyClass(Interface):
   [...]
   csv=Bytes(
       [...]
   )

class MyClass(object):
   [...]
   get_file(self):
      [... put database code here that returns a csv file - if you like ...]
   set_file(self,data):
      [... data contains you file's content. process it as you like ...]
   csv=property(get_file,set_file)

Just use an <editform> to get a file upload view.

Regards,

Frank



_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to