Passing additional data with the async upload

2 posts, 0 answers
  1. ben
    ben avatar
    27 posts
    Member since:
    Jun 2008

    Posted 14 Aug 2012 Link to this post

    Hello Telerik Team,

    I'd like to know if there's any way to pass in an extra parameter to my controller action when using async upload.  Below is what the controller looks like.

    public ActionResult Save(IEnumerable<HttpPostedFileBase> files, string uploadID)
    {
     
    }

    One workaround I came up with is to use the route value below.  The I can update the saveUrl property of the upload control to inject the correct uploadID before the upload begins.  

    @(Html.Kendo().Upload()
        .Name("files")
        .Async(a => a
            .Save("Save", "Upload", new { uploadID = "XXX" })
            .Remove("Remove", "Upload")
            .AutoUpload(true)
        )
    )

    If there's a proper solution to this, please advice.  Thank you!
  2. Rene
    Rene avatar
    65 posts
    Member since:
    Nov 2010

    Posted 19 Feb 2013 Link to this post

    Like this:
     
    @(Html.Kendo().Upload()
            .Name("imageFile")
            .Async(a => a
                 .Save("Save", "Pics" )
             )
            .Events(events => events
                 .Upload("onImageUpload")
             )
      )


    function onImageUpload(e){
        e.data = { uploadID: $("#IMAGE_GUID").val() };
      }
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top