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

Additional input required for each file selected?

6 Answers 72 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert
Top achievements
Rank 1
Robert asked on 05 Dec 2011, 08:51 PM
Is it possible to place additional input controls (e.g. a DropDownList) next to each file the user selects for upload?
In addition to the file, the user also needs to make a selection from this dropdown that further describes the type of file they are uploading.

6 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 07 Dec 2011, 04:48 PM
Hi Robert,

The Upload does not provide means to insert additional input elements for the file entries. We recommend you to take a look at the Upload in Grid code library that uses the Grid for building a custom upload form.

I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Robert
Top achievements
Rank 1
answered on 07 Dec 2011, 05:01 PM
Thanks for the pointer Tsvetomir!
0
Robert
Top achievements
Rank 1
answered on 07 Dec 2011, 05:02 PM
Thanks for the pointer Tsvetomir!
0
Robert
Top achievements
Rank 1
answered on 07 Dec 2011, 05:02 PM
Thanks for the pointer Tsvetomir!
0
Shane Milton
Top achievements
Rank 2
answered on 22 Dec 2011, 06:43 PM
We have this need as well. What we're attempting to do is handle the OnUpload event and make an Ajax call to send our additional data to the server and insert it into a database and return an id. We're then going to trick the upload control (if we can - this is the part we still need to prove is possible) into posting to a controller with the ID. Since we cant directly attach the data, we're going to modify the controller/handler being called and use our routing setup (actually the default routing setup) to pull the ID out. So instead of posting to "https://www.example.com/File/Upload", where "File" is the controller and "Upload" is the action handler, we're be posting to "https://www.example.com/File/Upload/17" where "File/Upload" is the controller and "17" is the action handler (or so the upload control thinks) whereas our routing sees the 17 and shoves it into the "id" parameter of our action handler, which has the signature: public ActionResult Upload(long id, IEnumerable<HttpPostedFileBase> attachments)

Hopefully this works, but we'll see. Just posting this for now in case this gives anybody an idea. I still need to figure out how to use jquery to change the URL being posted to...
0
Makoto
Top achievements
Rank 1
answered on 09 Feb 2012, 08:29 PM
I've found a way to do it and it's pretty simple.

You just need to handle the onUpload event and set the "data" property of the event argument to the values you want to set.

In your event handler method, simply do something like this:

function onUpload(e){
    var param1 = $('#dropDown').val();
    var param2 = $('#textBox').val();
 
    e.data = { p1:param1, p2:param2 };
}

Then, what that will do is pass those values as part of the querystring in the URL.

So for example, you're URL was "http://www.mysite.com/files/upload", then it would post to:
"http://www.mysite.com/files/upload?p1=123&p2=sometext"
Tags
Upload
Asked by
Robert
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Robert
Top achievements
Rank 1
Shane Milton
Top achievements
Rank 2
Makoto
Top achievements
Rank 1
Share this question
or