[Zope3-Users] Multiple File upload field?

Paul Carduner paulcarduner at gmail.com
Tue May 13 12:30:36 EDT 2008


On Tue, May 13, 2008 at 8:42 AM, Andrea Ratto
<andrearatto_liste at yahoo.it> wrote:
> I think something like that is achieved through a flash object, not with
> normal html form. I'm not a 100% sure though.

It really depends on what you want.  I think here we are talking about
a form that continuously pop up a new file field every time the last
one gets filled.  This is just like gmail.  You can then even upload
those files via an ajax call.  You can use jquery's form plugin to do
that.  What you won't get with html forms however, is a nice little
status bar telling you how much you have uploaded.  For that you
definitely need flash or a java applet or something similar.  That's
why when google uploads your attachment, it just annoying says
"Working..." then "Still Working..." because they don't actually have
any idea how much of the file(s) has been transfered up to that point.

> Il giorno ven, 09/05/2008 alle 15.43 +0530, Suresh V. ha scritto:
>> Has anyone come across a Multiple File field type that be used in a
>> form? This is to allow an unlimited number of files to be uploaded in a
>> single form.

I haven't seen a field or a widget that does this automagically.  I
would argue that this wouldn't even be a field.  I would probably
instead have an object field pointing to a container, which itself is
meant to contain the files you are uploading.

class IMyFile(zope.interface.Interface(zope.interface.Interface):
  file = zope.schema.Bytes()

class IMyFileUploader(zope.interface.Interface):
  files = zope.schema.Object(schema=zope.app.container.interfaces.IContainer)

Then there are a multitude of ways to turn this into a pretty upload
form, with increasing difficulty as you approach a highly generic
solution.


-- 
Paul Carduner
http://www.carduner.net


More information about the Zope3-users mailing list