Thanks very much! Everything works properly now! File upload
Thanks a lot!
Tuesday, January 11, 2005, 7:38:12 PM, you wrote:
have a look at the class CallbackDemo, to see a lot of
callbacks in SmallWiki. Also have a look at Action>>executeCallback and
all the messages it sends to see how the callbacks are evaluated.
I know, that the way callbacks are handled in
SmallWiki 1 isn't that
easy to understand, but still it is probably the best you can get from
a state-less framework as opposed to Seaside.
Note that on every request there is a new action
instance created, I
refer to the new one when talking about the one currently running and
to the old one when talking about the one that was used to render the
page that set-up the callbacks.
A callback is either a symbol or a block that will be
necessary. Let's have a look at the two cases independently:
1. a symbol will be performed on the new action.
2. a block will be evaluated with the new action as
This is what you observed.
For form elements the submitted value and the mime
type are passed in,
if your symbol or block accepts more arguments. So for your action you
maybe want to use a block like
html fileUploadWithCallback: [ :action :file
:mime | ... ]
or a selector like
And probably you should render your form like this:
html attributeAt: 'enctype' put:
html form: [ ... ] action: self.
The first line is actually a requirement of the HTTP
protocol, when you
want to make sure that files are properly transmitted. The second line
should replace your #form: It makes sure that the callbacks are
evaluated within the same structure and within the same action class,
else you'll loose your context and the callback will be probably
performed at the wrong place and an error will be raised. Actually I
don't know what happens if you specify a form without an url handler.
I hope this helps. Else there are some more examples
about this topic in the mailing-list archive.