Ejemplo n.º 1
0
            void XhrComplete()
            {
                var filesInQueue  = int.Parse(Request.QueryString["queue"] ?? "0");
                var filesUploaded = int.Parse(Request.QueryString["uploaded"] ?? "0");
                var reason        = Request.QueryString["reason"];

                AjaxFileUploadCompleteAllReason completeReason;

                switch (reason)
                {
                case "done":
                    completeReason = AjaxFileUploadCompleteAllReason.Success;
                    break;

                case "cancel":
                    completeReason = AjaxFileUploadCompleteAllReason.Canceled;
                    break;

                default:
                    completeReason = AjaxFileUploadCompleteAllReason.Unknown;
                    break;
                }

                var args = new AjaxFileUploadCompleteAllEventArgs(filesInQueue, filesUploaded, completeReason);

                if (UploadCompleteAll != null)
                {
                    UploadCompleteAll(Control, args);
                }
                Response.Write(new JavaScriptSerializer().Serialize(args));
            }
 protected void AjaxFileUpload1_UploadCompleteAll(object sender, AjaxFileUploadCompleteAllEventArgs e)
 {
     var startedAt = (DateTime)Session["uploadTime"];
     var now = DateTime.Now;
     e.ServerArguments = new JavaScriptSerializer()
         .Serialize(new {
             duration = (now - startedAt).Seconds,
             time = DateTime.Now.ToShortTimeString()
         });
 }
Ejemplo n.º 3
0
    protected void AjaxFileUploadMultiple_UploadCompleteAll(object sender, AjaxControlToolkit.AjaxFileUploadCompleteAllEventArgs e)
    {
        Dictionary <string, byte[]> file_Upload_Array = new Dictionary <string, byte[]>();
        //string strUploadPath = "~/K_Log/" + Request.UrlReferrer.Query.Split(new char[]{'='})[1].ToString() + "/";
        string strUploadPath = "~/K_Log/" + Session["Folder_Name2"].ToString() + "/";

        string[] _files = Directory.GetFiles(Server.MapPath(strUploadPath));
        if (_files != null && _files.Length > 0)
        {
            for (int i = 0; i < _files.Length; i++)
            {
                FileInfo fl = new FileInfo(_files[i]);
                file_Upload_Array.Add(fl.Name, File.ReadAllBytes(fl.FullName));
            }
        }
        Session["FileUpload2"] = file_Upload_Array;
        AllClasses.Create_Directory_Session2();
    }
 protected void AjaxFileUpload1_UploadCompleteAll(object sender, AjaxControlToolkit.AjaxFileUploadCompleteAllEventArgs e)
 {
 }
Ejemplo n.º 5
0
            void XhrComplete()
            {
                var filesInQueue = int.Parse(Request.QueryString["queue"] ?? "0");
                var filesUploaded = int.Parse(Request.QueryString["uploaded"] ?? "0");
                var reason = Request.QueryString["reason"];

                AjaxFileUploadCompleteAllReason completeReason;
                switch(reason) {
                    case "done":
                        completeReason = AjaxFileUploadCompleteAllReason.Success;
                        break;

                    case "cancel":
                        completeReason = AjaxFileUploadCompleteAllReason.Canceled;
                        break;

                    default:
                        completeReason = AjaxFileUploadCompleteAllReason.Unknown;
                        break;
                }

                var args = new AjaxFileUploadCompleteAllEventArgs(filesInQueue, filesUploaded, completeReason);
                if(UploadCompleteAll != null)
                    UploadCompleteAll(this, args);
                Response.Write(new JavaScriptSerializer().Serialize(args));
            }