Question: I have to add an Upload file functionality using Kendo ui in my grails application. also i have to know how to change the upload location.

thnks

Answer: 
Here is the solution that we came up with to dynamically change the saveUrl on the Kendo UI Upload widget.

Controller code:

```
public class MediaController : ApiControllerBase
{
    public Task<HttpResponseMessage> Post()
    {
        var queryVals = Request.RequestUri.ParseQueryString();
        string idValue = queryVals["id"].ToString();

        ... CODE REMOVE FOR BREVITY
    }
}

```

And the Script code:

```
<div style="width:45%">
            <input class="upload" name="files" id="files" type="file" upload-id="02ebeebf-98aa-459b-b41f-49028fa37e9c" />
           <input class="upload" name="files2" id="file1" type="file" upload-id="499499D3-1C80-4930-8C8D-C87F17884D3F" />
        </div>

        <script>
            $(document).ready(function () {
                $(".upload").kendoUpload({
                    async: {
                        saveUrl: "/API/Media",
                        autoUpload: true
                    },
                    upload: function onUpload(e) {
                        var uploadId = e.sender.wrapper.prevObject.attr("upload-id");
                        e.sender.options.async.saveUrl = "/api/media?id=" + uploadId;
                    },
                });
            });

        </script>

```
Check out the KendoUI Upload configuration documentation here: <http://www.kendoui.com/documentation/ui-widgets/upload/configuration.aspx>

The saveUrl option on the async object allows you to set the handler for the submitted file(s) with ease.