Found a different solution, in case somebody is interested:

             fileUploadField.add(new AjaxEventBehavior("onchange")
            {
                protected void onEvent(AjaxRequestTarget target) {
                    Request request = RequestCycle.get().getRequest();
                    String filename = request.getParameter("filename");
                    System.out.println("filename is [" + filename + "]");
                }

                public CharSequence getCallbackUrl(boolean 
onlyTargetActivePage) {
                    CharSequence callBackUrl =  
super.getCallbackUrl(onlyTargetActivePage);
                    return callBackUrl + "&filename=' + this.value + '";
                }

            });

not as beautiful as I'd like to have it, because I'm manually messing around 
with the callback url, but it works :-).

:-),
Thomas


-------- Original-Nachricht --------
> Datum: Wed, 27 Aug 2008 22:51:51 +0200
> Von: "Mattom" <[EMAIL PROTECTED]>
> An: [email protected]
> Betreff: Re: fileupload element checking filename existing before upload 
> using ajax

> That's what I've found, too, that uploading using ajax is not possible. 
> 
> But :-), I don't need the upload to be ajax, all I need is the filename,
> as soon as the file was choosen by the user.
> That way I could validate the filename serverside, and provide immediate
> feedback, before the (maybe) long upload is performed.
> So, just adding a parameter to the ajax "onchange" call would do the
> trick. 
> 
> What I'll try now is adding another "hidden" ajax form, link the file
> upload element to a hidden field in this form, and then "manually" submit this
> form, by adding my own "wicket free" javascript... not beautiful, but
> should work.
> 
> Thanks for your help,
> Thomas
> 
> -------- Original-Nachricht --------
> > Datum: Wed, 27 Aug 2008 08:57:01 -0700 (PDT)
> > Von: Michael Sparer <[EMAIL PROTECTED]>
> > An: [email protected]
> > Betreff: Re: fileupload element checking filename existing before upload
> using ajax
> 
> > 
> > the problem is file uploading with ajax - that's just not possible
> > (restriction of the http protocol as far as I remember), however you can
> > 'simulate' using some approaches, e.g. a hidden iframe where you post
> your
> > file to. 
> > that topic has been discussed many times, just search the list - if i
> > remember correctly there's already a component for that somewhere in
> > wicketstuff ...
> > 
> > regards,
> > Michael
> > 
> > Thomas Lutz wrote:
> > > 
> > > Hi list !
> > > 
> > > I'm trying to build a upload form consisting of one ore more
> > fileuploads.
> > > 
> > > If the file(s) already exist(s) on the server, I'd like to throw a
> > > validation message, but, before uploading takes place.
> > > 
> > > I tried to attach AjaxEventBehavior to the FileUploadField, onchange
> is
> > > executed, but I've no access to the current value of the file input
> > > element. Tried AjaxFormComponentUpdatingBehavior as well, no success.
> > > 
> > > How should I approach this ? Basically all I need is ajaxing the
> > onchange
> > > with the "new value" back to the server.
> > > 
> > > Thanks for your help,
> > > Thomas
> > > -- 
> > > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
> > > Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > > 
> > > 
> > 
> > 
> > -----
> > Michael Sparer
> > http://talk-on-tech.blogspot.com
> > -- 
> > View this message in context:
> >
> http://www.nabble.com/fileupload-element-checking-filename-existing-before-upload-using-ajax-tp19181551p19184026.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> -- 
> GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry
> Passion!
> http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to