This is a migrated thread and some comments may be shown as answers.
Returning Success State to the client
1 Answer 189 Views
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 17 Jul 2012, 05:33 PM
I'm using the Upload extension to upload an image, pretty straighforward.  On the server I give the image file my own custom name (a guid) and then save it to server storage.  Great so far, this all works fine.  However what I would like to do is pass this new image url back to the client on the success event.  The problem is that from what I've seen so far, returning anything other than an empty string is interpreted by the upload control on the client as an error and is routed to the "onError" handler.

Is there a way that I can pass this state back to the client and still handle it in the "onSuccess" event?  Basically I want to give this path to another control on my page so that it can refresh itself with the new URL.  The only other ways I can think to make this happen is to:

Handle "onError" and fudge it to also handle a success by looking at what was returned. (pretty stinky)

Have the second control perform an ajax postback "onSuccess" and reload it's own state from the server, but of course this would add an extra postback for each upload that happens.  Was hoping to avoid this if possible.

Any ideas are appreciated, thanks!

Eric

1 Answer, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 18 Jul 2012, 02:50 AM
Just found the information on this in the docs:

http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/upload/metadata



THanks,

Eric S
Asked by
Eric
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Share this question
or