This is a migrated thread and some comments may be shown as answers.

Additional variables to the save handler

3 Answers 279 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Иван
Top achievements
Rank 1
Иван asked on 02 Nov 2011, 09:56 AM
Hello,
Can you give me an example how to send additional variables to the save handler with the upload widget. I found the "upload" event, and the data object in it, but it is still not clear to me.

Thanks

3 Answers, 1 is accepted

Sort by
0
Cuinn
Top achievements
Rank 1
answered on 28 Nov 2011, 11:57 PM
Hi,

The additional data object simply expects a list of key/value pairs that will be passed on in the post request as variables.  For example:

function onUpload(e) {
    e.data = {StringVar1: 'This is my value', ItemId: 56, Action: 'add'}
}

These should then be available in the request object.  I'm grabbing them with the following line of code in an ashx file.

context.Request.Form("Action")

Although you could get it via the following as well: context.request("Action"). I'm not sure exactly about the php syntax, but I'm sure you can figure it out if needed.

Regards,
Cuinn.
0
Ege
Top achievements
Rank 1
answered on 03 Dec 2011, 07:46 PM
Hi,

I just discovered kendoui and the library is very promising. Thank you for your effort.

I have been trying to figure out this myself for the past half hour until I found the forum. Documentation for upload event handler is written in a way that makes me think that the callback expects 2 parameters, files and data. I recommend you fix the documentation to match the information in this thread, hopefully with the example.

Using php, $_POST['StringVar1'] can be used to read the first item in the example.
0
T. Tsonev
Telerik team
answered on 06 Dec 2011, 06:05 PM
Hi Ege,

Thank you for your feedback. We've updated the Upload documentation and the events section in particular.

Regards,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Upload
Asked by
Иван
Top achievements
Rank 1
Answers by
Cuinn
Top achievements
Rank 1
Ege
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or