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

Passing additional data with the async upload

1 Answer 1345 Views
Upload
This is a migrated thread and some comments may be shown as answers.
ben
Top achievements
Rank 1
ben asked on 14 Aug 2012, 06:47 PM
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!

1 Answer, 1 is accepted

Sort by
0
Rene
Top achievements
Rank 1
answered on 20 Feb 2013, 02:20 AM
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() };
  }
Tags
Upload
Asked by
ben
Top achievements
Rank 1
Answers by
Rene
Top achievements
Rank 1
Share this question
or