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