1

I've spend hours trying to make uploadify work, but all I see is a button that says [Select File] and that does nothing. Found some links like Multiple file upload in MVC using Uploadify and Using uploadify with ASP.Net2 resulting in the same. And with the information from uploadify.com it doesn't work either. So I'm stuck at uploadify.

I also noticed that most info is at least one year old. Now I'm wondering if this is THE way to go, or can you recommend a better way? Currently I'm looking at File upload asp.net mvc3 which looks really nice and simple, but only lets you upload 1 file at a time...

Kind regards,

Paul.

Community
  • 1
  • 1
keun
  • 335
  • 6
  • 13
  • Can you share us the code that what did you tried for uploadify? – Kundan Singh Chouhan Aug 09 '12 at 16:36
  • I've had good luck with plupload. I've used it in MVC3 apps and used each method on the client (html5, flash, silverlight, etc..) – BZink Aug 09 '12 at 16:55
  • I wonder how u missed Phil Haack's [article](http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx) for this ? what keywords you used for the search.. – Yasser Shaikh Aug 09 '12 at 17:45
  • Yep, it came accross. But I want to be able to upload multiple, not resctricted to 2. – keun Sep 04 '12 at 15:59
  • I will now investigate plupload. Didn´t came accross that one. Thanks for the hint. – keun Sep 04 '12 at 16:03

1 Answers1

4

One approach is:

According to Phil Haack http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx

You can do this:

<form action="" method="post" enctype="multipart/form-data">

 <label for="file1">Filename:</label>
 <input type="file" name="files" id="file1" />

 <label for="file2">Filename:</label>
 <input type="file" name="files" id="file2" />

 <input type="submit"  />
 </form>

And the controller..

[HttpPost]
public ActionResult Index(IEnumerable<HttpPostedFileBase> files) {
 foreach (var file in files) {
 if (file.ContentLength > 0) {
   var fileName = Path.GetFileName(file.FileName);
   var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
   file.SaveAs(path);
 }
}
return RedirectToAction("Index");
}

Second approach:

Using KendoUI's upload. It allows upload multiples files synchronously and asynchronously.

The Upload can be used as a drop-in replacement for file input elements.

http://demos.kendoui.com/web/upload/index.html

Clarification: No version of IE supports multiple file selection.

Pablo Claus
  • 5,886
  • 3
  • 29
  • 38
  • 1
    Both of these approaches will work. We actually uses the Telerik MVC extensions, which were the precursor to the Kendo UI library, at work and they work pretty well. – ryanulit Aug 09 '12 at 16:55
  • That's right. I migrated from Telerik to Kendo UI extensions a month ago. – Pablo Claus Aug 09 '12 at 17:02
  • Sorry, just came back from holiday. Gave Uploadify another try today, still won´t work right. Ofcourse came accross Phil Haack´s simple solution for multiple files. Indeed 2 is a multiple, but I want to be able to really select multiple, not just 2. – keun Sep 04 '12 at 15:56
  • @keun I just tried kendo upload's demo and could select 3 files. Did you see this? http://demos.kendoui.com/web/upload/async.html – Pablo Claus Sep 04 '12 at 16:24
  • @Pabloker Yes saw that. But the dialog will only let me choose 1 file each time. When clicking select-button a second time I can choose another one. Kind of a hassle when I want 20 for example. – keun Sep 05 '12 at 10:11
  • @keun I just tried again, and I could select 3 files at the same time and Kendo Upload (async) added them perfectly. Try to select the files using “shift” in the selection dialog. (Use this example http://demos.kendoui.com/web/upload/async.html) – Pablo Claus Sep 05 '12 at 11:14
  • @Pabloker Hmmmm.. IE just lets me select one. In FF I can select multiple but only 1 occurs... :-s – keun Sep 05 '12 at 12:10
  • @keun I'm using Chrome. According to Telerik support _IE does not support multiple file selection in the browse dialog_ so sad. – Pablo Claus Sep 05 '12 at 12:17