12 Answers, 1 is accepted
Yes, this is possible. You can add metadata to files that are being uploaded asynchronously.
Alternatively, you can submit the upload as part of a form (synchronous upload) along with any other form fields.
Tsvetomir Tsonev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Your method is
public
ActionResult Save(IEnumerable<HttpPostedFileBase> attachments,
string
description)
but should be
public
ActionResult Save(IEnumerable<HttpPostedFileBase> attachments,
string
fileDescription)
Thanks.
Fixed, thank you for the heads-up. Some Telerik points coming your way.
Best wishes,Tsvetomir Tsonev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

You can use the OnRemove client-side event to send custom data in a similar way.
Kind regards,Tsvetomir Tsonev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

I have set up the onRemove client handler and attempted to use it to add metadata to the post in the same way as adding metadata to and upload. When a client uploads an a file asyncronously it is added to a database, I would like the remove command to remove it from the database also, but need to identify the client that sent the request as well as the filenames being removed.
eg's
function onUpload(e) {
e.data = { 'clientId': clientId };
}
function onRemove(e) {
e.data = { 'clientId': clientId };
}
The onRemove function is called, but the post for remove does not include any form data or query string for any of the e.data. Can I somehow use the onRemove handler to add my own custom metadata? Also what is the callback parameter that is added to the querystring? Thanks,
This is a known issue that has been fixed. The fix is available in the Service Pack that will be released later today.
Kind regards,Tsvetomir Tsonev
the Telerik team

We are using 2012.1.214 version and i am having the same problem with upload button. Like i am trying to upload which multiple is false and for the second upload it is calling Remove server method with params null. I want to send the filename to that method but i can't.
My code snippet is:
@(Html.Telerik().Upload()
.Name("attachments")
.Multiple(false)
.Async(async => async
.Save("SaveTempFile", "FileUpload")
.Remove("Remove", "FileUpload")
.AutoUpload(true))
.ClientEvents(events => events
.OnLoad("OnLoad")
.OnSuccess("OnSuccess")
.OnRemove("OnRemove")
))
public JsonResult Remove(string[] fileNames, string file)
{
}
Client event OnRemove is calling when i click on Remove not for second upload. So how to pass fileName param to server method.
I can be able to get the uploaded file name in fileNames array but i need to fill the other file param as well because while storing the file i am saving with guid as filename.
I tried with .Remove("Remove", "FileUpload", new { file = ViewBag.FileUniqueName }) as well but no use.

I had the same problem as Ben, the JS method (onUpload) is not called when running the code. (my telerik version is : Telerik_Extensions_for_ASPNET_MVC_2012_1_214_Commercial)
The issue has not been fixed yet ?

Delete the file in the directory by sorting the files by date of creation
public ActionResult Remove(string[] fileNames)
{
// The parameter of the Remove action must be called "fileNames"
foreach (var fullName in fileNames)
{
var fileName = Path.GetFileName(fullName);
string uploadFolder = AppDomain.CurrentDomain.BaseDirectory + "UploadCommunity\\";
DirectoryInfo directInfo = new DirectoryInfo(uploadFolder); //read directory to enumerate files
FileInfo[] filelist = directInfo.GetFiles();
var fileList = from n in filelist select new { FileName = n.FullName, CreationDate = n.CreationTime }; //get list of files by creationtime
var latestFile = (from m in fileList orderby m.CreationDate descending select m.FileName).First<string>(); //get the first file from the sorted list (descending order)
FileInfo file = new FileInfo(latestFile);
file.Delete();
}
// Return an empty string to signify success
return Content("");
}

I am using the 2012.3.114 version and still having a problem passing parameters to the server Remove action.
Here's the code snippet
@(Html.Kendo().Upload()
.Name("files")
.Async(a => a
.Save("Save", "Home")
.Remove("Remove", "Home")
.AutoUpload(true)
)
.Events(events => events
.Select("onSelect")
.Upload("onUpload")
.Remove("onRemove")
.Error("onError")
)
)
var onUpload = function(e) {
e.data = { 'Id': $("#Id").val()};
};
var onRemove = function(e) {
e.data = { 'Id': $("#Id").val()};
};
In the controller the Remove always shows null for the passed in params.
The same code for Upload works.
Please help.
