How to handle multiple file upload controls on the same page in ASP.net MVC?

Last post 06-13-2011, 12:59 AM by Kenneth. 2 replies.
Sort Posts: Previous Next
  •  06-12-2011, 12:47 PM 67909

    How to handle multiple file upload controls on the same page in ASP.net MVC?

    Hi,
     
    Is there a sample to handle multiple file upload controls on the same page in ASP.net MVC?
     
    Thnx.
  •  06-12-2011, 6:20 PM 67912 in reply to 67909

    Re: How to handle multiple file upload controls on the same page in ASP.net MVC?

    Dear goalcircuit,
     
    Please refer to "MVC2-CSharp\Views\Samples\Sample2.aspx",  you can find this example in download package, it demonstrates how to use multiple files upload in ASP.NET MVC.
     
    Thanks for asking
  •  06-13-2011, 12:59 AM 67913 in reply to 67909

    Re: How to handle multiple file upload controls on the same page in ASP.net MVC?

    Hi goalcircuit,

     

    Try this way

     

    1.       Open file “\Controllers\SamplesController.cs”

     

    2.       Add the section below into method “public ActionResult Sample1(string myuploader)

     

     using (CuteWebUI.MvcUploader uploader2 = new CuteWebUI.MvcUploader(System.Web.HttpContext.Current))

                {

                    uploader2.UploadUrl = Response.ApplyAppPathModifier("~/UploadHandler.ashx");

                    //the data of the uploader will render as <input type='hidden' name='myuploader'>

                    uploader2.Name = "myuploader2";

                    uploader2.AllowedFileExtensions = "*.jpg,*.gif,*.png,*.bmp,*.zip,*.rar";

     

                    uploader2.InsertText = "Select a file to upload";

                    uploader2.SetAdvancedOption(CuteWebUI.UploaderAdvancedOption.NoSilverlight, "true");

                    //prepair html code for the view

                    ViewData["uploaderhtml2"] = uploader2.Render();

                }

     

    3.       Than you can add a new uploader control into page “\Views\Samples\Sample1.aspx” like below

     

     <%=ViewData["uploaderhtml2"] %>

     4. Now, open example "Sample1" and try again.

    Regards,

    Ken

View as RSS news feed in XML