"Ross J. Reedstrom" wrote:
On Sun, Jun 13, 1999 at 01:27:02PM -0100, Tom Schwaller wrote:
Hi, can someone give me a simple example how to do the following:
I`d like to have an enhanced Image-Upload-Form, which takes the image (on the local file system) you choose, adds some properties to this image which you can fill in the Form (a few text strings like URL e.g.) and returns the reply I wish (not this ok-Buttons..).
Tom - I've done something similar with a generic file upload/exchange site. I wanted to tag each File with the (authenticated) user who uploaded it. There's three tricks involved. The first is the standard Zopeism of having a user interface Form method/page, which then calls a non-interface Action method/page. The second is to discover that the various manage_* methods will return to your method if called without a REQUEST variable being set. The third to another Zopeism: using the :method tag on a FORM input NAME to call a method, but not have it show up in the URL. That way, all these file/object management pages bookmark as my main interface page.
A couple notes about my (ugly, but functional) methods below: It still implements a click through 'ok', but it returns to my page, not the standard management interface.
I've still got some functionality to implement, (i.e. the comment in the code about name collisions), but I think I'm bumping up against what should be done in DTML and what should be moved into external methods.
Anyone have any suggestions on improving this code, feel free to comment.
Here's my addFileForm (mostly stolen from the imageUpload.dtml source):
Hi Ross, cool, thanks a lot. Not kind of obvious. Your example is of GREAT help to me. I think I can now implement what I want... When I upload an image with the code you postet, the resulting object is not a "normal" image object (although it has every attribute one wants, including the "addedby"). The icon although is different and there's also a thing called Precondition (which is empty..) Any idea what that is? cu and it is fun to be on this list :-) -- Tom http://www.linux-magazin.de/