Articles in this section

How to show or hide waiting popup at the time of uploading using UploadBox

How to show or hide waiting popup at the time of uploading

We You can show or hide the waiting popup in the upload begin event and hide the waiting popup in or upload complete event.

cshtml

<div class="frame">

        <div class="control">

            Select a file to upload

            <div class="posupload">

                @Html.EJ().Uploadbox("UploadDefault").SaveUrl("SaveDefault").Locale("en-US").RemoveUrl("RemoveDefault").ClientSideEvents(e => e.Complete("uploadComplete").Begin("fileuploadbegin"))

            </div>

            <div>

                <div id="target"></div>

                @Html.EJ().WaitingPopup("target").ShowOnInit(false)

            </div>

        </div>

    </div>

 

cs

public ActionResult SaveDefault(IEnumerable<HttpPostedFileBase> UploadDefault)

         {

             foreach (var file in UploadDefault)

             {

                 var fileName = Path.GetFileName(file.FileName);

                 var destinationPath = Path.Combine(Server.MapPath("~/App_Data"), fileName);

                 file.SaveAs(destinationPath);

             }

             return Content("");

         }

         public ActionResult RemoveDefault(string[] fileNames)

         {

             foreach (var fullName in fileNames)

             {

                 var fileName = Path.GetFileName(fullName);

                 var physicalPath = Path.Combine(Server.MapPath("~/App_Data"), fileName);

                 if (System.IO.File.Exists(physicalPath))

                 {

                     System.IO.File.Delete(physicalPath);

                 }

             }

             return Content("");

         }

 

js

function uploadComplete() {

            var obj = $("#target").data("ejWaitingPopup");

            obj.hide();

}

 function fileuploadbegin() {

            var obj = $("#target").data("ejWaitingPopup");

            obj.setModel({ target: "#" + this.diaObj.wrapper[0].id, showOnInit: true });

}

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied