locked
how to get response in OnClientUploadCompleteAll function in ajaxToolkit:AjaxFileUpload RRS feed

  • Question

  • User-1575600908 posted

    hello to all

    i use ajaxToolkit:AjaxFileUpload and i want in OnClientUploadCompleteAll function get response from server

    for example pass e message and show it 

    my code is

    <ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload2" AllowedFileTypes="jpg,jpeg,png" OnClientUploadCompleteAll="loadFuction" CssClass="FileAttachmentUpload" OnUploadComplete="anyUploader_UploadComplete" runat="server" />
                function loadFunction(e) {
                    error = '<%=_errorMessage%>';
    console.log(error); if ($("#" + '<%=uploadStatus.ClientID%>').val() == "false") { loadSliderPic(); changeText(); } else { $("#AjaxFileUploader_FileStatusContainer").text(''); $("#AjaxFileUploader_QueueContainer").text("خطا: ابعاد تصویر آپلود شده صحیح نمی باشد.").css("color", "red"); } }
     public sting  _errorMessage = "error";
    
                            AjaxFileUploader.SaveAs(Server.MapPath("~/Uploades/SliderImg/" + e.FileName));
                            System.Drawing.Image objImage = System.Drawing.Image.FromFile(Server.MapPath("~/Uploades/SliderImg/" + e.FileName));
                            if (objImage.Width == 1003 && objImage.Height == 352)
                            {
                                System.IO.DirectoryInfo _imageAddress = new System.IO.DirectoryInfo(MapPath("~\\Uploades\\SliderImg"));
                                db.deleteXmlNode("SliderImageAddress", null);
                                int counter = 0;
                                foreach (System.IO.FileInfo item in _imageAddress.GetFiles())
                                {
                                    if (item.Extension == ".jpg" || item.Extension == ".png" || item.Extension == ".jpeg")
                                    {
                                        db.insertXmlNode("SliderInformation", "SliderImageAddress", "..\\Uploades\\SliderImg\\" + item.Name + ",", "Name", counter++.ToString());
                                    }
                                }
                                uploadStatus.Value = "false";
                                _errorMessage = "Error in file size";


    in console i see "error" Instead of "Error in file size"

    Monday, June 16, 2014 3:50 AM

Answers