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

  •  06-13-2011, 12:59 AM

    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 Complete Thread