[Zope3-Users] Uploading files
Stéphane Brault
stephane_brault at yahoo.fr
Tue Jun 20 06:59:55 EDT 2006
Thanks Frank,
I'll try that,
Stéphane
----- Message d'origine ----
De : Frank Burkhardt <fbo2 at gmx.net>
À : Stéphane Brault <stephane_brault at yahoo.fr>; zope3-users at 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
More information about the Zope3-users
mailing list