Current filter:
                                You should refresh the page.
                                  • Hello there,

                                    I have worked with your upload control quite a bit in the past but have never implemented a progress panel as you describe on "http://demos.devexpress.com/ASPxperienceDemos/UploadControl/CustomProgressPanel.aspx". I am trying to do this now and at this point I have even reverted to using your exact code from the example but I get a weird permission denied error from JScript when the file is bigger than a few K.

                                    The error I get is "Microsoft JScript runtime error: Permission denied" when the following script code is being executed: "GetIsResponseValid: function() {
                                      var ret = false;
                                      try {
                                       if (eval(this.GetFakeIframeResponseString()) != null)
                                        ret = true;
                                      }"

                                    It results in nothing being uploaded and the screen stopping with the progress bar in the modal window ontop of the page.

                                    Any help you can provide would be great. Thanks

                                Hello Dustin,

                                Thank you for contacting us. Please ensure that:
                                1) The .NET Trusted Level = "Full", since we use the HttpWorkerRequest class to obtain information about the progress of the uploading request;
                                2) The ASPxHttpHandlerModule and the Upload Control Http Handler are registered within all required Web.config's section(s): How to: Manually Register an HttpHandler Module;
                                3) The "maxRequestLength" key should be defined within the Web.config's "httpRuntime" section. It is unlikely that this key is specified within the ASPxUploadControl -> SmartTag.

                                If this does not help, please describe your scenario (what file(s) you try to upload), the ASPxUploadControl definition, the (hosting) server configuration. We will do our best to help you.

                                See Also:
                                ASPxUploadControl Permission denied
                                ASPxUploadControl - Access Denied on UploadingProgressChanged

                                Regards,
                                Mike

                                OK so that problem ended up being a permission issue in IIS actually but thank you for the quick response.

                                Now my problem is that the progress panel never gets displayed if I have it in the window.setTimeout("ShowPopupProgressingPanel()",700); it's like the javascript stops before being able to register it. If I take it out of the setTimeout then it displays but freezes until the file is completely uploaded and it never updates with the progress bar moving.

                                I have it reverted back to the original demo:

                                MARKUP and javascript:

                                <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucAttachments.ascx.cs" Inherits="DealerDesk.UserControls.Attachments" %>
                                <%@ Register Assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
                                    Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
                                <%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
                                    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
                                <%@ Register Assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
                                    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
                                <%@ Register Assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
                                    Namespace="DevExpress.Web.ASPxUploadControl" TagPrefix="dx" %>

                                <script type="text/javascript">
                                    // <![CDATA[
                                    var uploadValidFlag;
                                    var uploadCompleteFlag;
                                    function UploadingProgressChanged(s, e) {
                                        pbProgressing.SetPosition(e.progress);
                                        var info = e.currentFileName + " [" + GetKBytes(e.uploadedContentLength) + " / " + GetKBytes(e.totalContentLength) + "] KBytes";
                                        pnlProgressingInfo.SetContentHtml(info);
                                    }
                                    function FileUploadStart(s, e) {
                                        uploadValidFlag = true;
                                        uploadCompleteFlag = false;
                                        ShowPopupProgressingPanel();
                                    }
                                    function FileUploadComplete(s, e) {
                                        if (!e.isValid)
                                            uploadValidFlag = false;
                                    }
                                    function FilesUploadComplete(s, e) {
                                        uploadCompleteFlag = true;
                                        PopupProgressingPanel.Hide();
                                        if (uploadValidFlag)
                                            window.setTimeout("alert('Uploading is complete.')", 0);
                                    }
                                    function ShowPopupProgressingPanel() {
                                        if (!uploadCompleteFlag) {
                                            PopupProgressingPanel.Show();
                                            pbProgressing.SetPosition(0);
                                            pnlProgressingInfo.SetContentHtml("");
                                        }
                                    }
                                    function GetKBytes(bytes) {
                                        return Math.floor(bytes / 1024);
                                    }
                                    // ]]>
                                </script>

                                <dx:ASPxUploadControl ID="AttachmentUpload" runat="server"
                                    ShowAddRemoveButtons="true"
                                    ShowUploadButton="true"
                                    AddUploadButtonsHorizontalPosition="Left"
                                    OnFileUploadComplete="AttachmentUpload_FileUploadComplete"
                                    ClientInstanceName="cinAttachmentUpload">
                                    <ValidationSettings
                                        AllowedFileExtensions=".txt,.jpg,.jpe,.jpeg,.doc,.png,.gif,.pdf,.bmp"
                                        MaxFileSize="30000000"
                                        FileDoesNotExistErrorText="This file can't be found."
                                        GeneralErrorText="An external error has occured in trying to upload this file."
                                        MaxFileSizeErrorText="Size of the uploaded file exceeds maximum file size."
                                        NotAllowedContentTypeErrorText="The uploaded file's content type isn't allowed."/>
                                    <clientsideevents fileuploadstart="FileUploadStart"
                                        UploadingProgressChanged="UploadingProgressChanged"
                                        FileUploadComplete="FileUploadComplete"
                                        FilesUploadComplete="FilesUploadComplete" />
                                </dx:ASPxUploadControl>

                                <dx:ASPxPopupControl ID="ASPxPopupControl1" runat="server" ClientInstanceName="PopupProgressingPanel"
                                    Modal="True" CloseAction="None" Width="400px" PopupHorizontalAlign="WindowCenter"
                                    PopupVerticalAlign="WindowCenter" AllowDragging="True" EnableAnimation="False"
                                    HeaderText="Uploading Info" ShowCloseButton="False">
                                    <ContentCollection>
                                        <dx:PopupControlContentControl ID="PopupControlContentControl1" runat="server">
                                            <table style="width: 100%;">
                                                <tr>
                                                    <td style="width: 100%;">
                                                        <dx:ASPxProgressBar ID="pbProgressing" ClientInstanceName="pbProgressing" runat="server"
                                                            Width="100%">
                                                        </dx:ASPxProgressBar>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxButton ID="btnCancel" runat="server" Text="Cancel" AutoPostBack="False">
                                                            <ClientSideEvents Click="function(s, e) { cinAttachmentUpload.Cancel(); PopupProgressingPanel.Hide(); }" />
                                                        </dx:ASPxButton>
                                                    </td>
                                                </tr>
                                            </table>
                                            <dx:ASPxPanel ID="pnlProgressingInfo" ClientInstanceName="pnlProgressingInfo" runat="server"
                                                Width="100%">
                                                <PanelCollection>
                                                    <dx:PanelContent ID="PanelContent1" runat="server">
                                                        Please wait while we upload to our server...
                                                    </dx:PanelContent>
                                                </PanelCollection>
                                            </dx:ASPxPanel>
                                        </dx:PopupControlContentControl>
                                    </ContentCollection>
                                </dx:ASPxPopupControl>

                                CODE BEHIND:

                                 protected void AttachmentUpload_FileUploadComplete(object sender, FileUploadCompleteEventArgs e)
                                        {
                                            try
                                            {
                                                e.CallbackData = SavePostedFiles(e.UploadedFile);
                                            }
                                            catch (Exception ex)
                                            {
                                                e.IsValid = false;
                                                e.ErrorText = ex.Message;
                                            }
                                        }

                                        string SavePostedFiles(UploadedFile p_UploadedFile)
                                        {

                                            string FolderName = ((Config)Session["Config"]).ConfigID.ToString();

                                            if (!p_UploadedFile.IsValid)
                                                return string.Empty;

                                            if (!Directory.Exists(MapPath(string.Format(UploadDirectory, FolderName))))
                                            {
                                                Directory.CreateDirectory(MapPath(string.Format(UploadDirectory, FolderName)));
                                            }

                                            FileInfo fileInfo = new FileInfo(p_UploadedFile.FileName);
                                            string resFileName = MapPath(string.Format(UploadDirectory,FolderName)) + fileInfo.Name;
                                            p_UploadedFile.SaveAs(resFileName);

                                            string fileLabel = fileInfo.Name;
                                            string fileType = p_UploadedFile.PostedFile.ContentType.ToString();
                                            string fileLength = p_UploadedFile.PostedFile.ContentLength / 1024 + "K";
                                            return string.Format("{0} <i>({1})</i> {2}|{3}", fileLabel, fileType,
                                                fileLength, fileInfo.Name);
                                        }

                                Hello Dustin,

                                Thank you for your example and description.
                                According to the description, the problem lies in that the ASPxUploadProgressHttpHandler has not been registered in the web.config file. Note that you can register the http handler manually, as well as use a smart tag of ASPxUploadControl (see the attached image).
                                I have created a small project based on your description. It works properly, see the attached video.

                                Please review the project, and let us know if you have other questions.

                                Best regards,
                                Vladimir

                                I have the handler registered:

                                <httpHandlers>
                                      <add type="DevExpress.Web.ASPxUploadControl.ASPxUploadProgressHttpHandler, DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="ASPxUploadProgressHandlerPage.ashx" validate="false" />
                                    </httpHandlers>
                                  </system.web>

                                I have even recreated the page and redone this with no luck. Is there any chance that my code behind is messing something up? If I have the setTimeout in there the panel doesn't even pop-up EXCEPT for at the very end after it has finished uploading for a spit second and then my alert box pops up immediately after. If I take it out of the setTimeout then it will show from the beginning but it never updates.

                                Is there anything else I can provide, short of the project as it is very sensitive to my company, that would help in this?

                                Thank you very much for all of the help.

                                Dustin

                                Hello Dustin,

                                Your inability to provide a sample project complicates the situation. We understand that this may be a commercial application, and we are ready to sign an NDA if necessary. Please also note that you can mark this ticket as Private. This will effectively prevent other users from accessing its contents. Moreover, I should underscore that we need your project for testing purposes only. We will surely delete all files from our servers once we have detected the cause of the problem and helped you resolve it. This would be even better if you could provide a simplified version of your project - just to illustrate the problem in action. This will allow us to give you a solution faster.

                                Still, I would like to know if the project attached to my previous answer works properly on your side. I have created it using your code example. Please see the video, showing how it works on my side.

                                In addition, I have noticed that you are using the v2010 vol 1.6 of our product, while you are eligible to use the most recent build - v2010 vol 2.6. I strongly recommend you upgrade your project to always use the latest DevExpress binaries. Note that I created the project using v2010 vol 2.6. Possibly, that is why I cannot reproduce the problem.

                                Best regards,
                                Vladimir

                                This project has about 15000 lines of code in it and I am a little skeptical that everything will "just work" if I upgrade for no great reason. I will try to extract a piece out so that you can see what it is doing.

                                Thank you.

                                Hello Dustin,

                                If you could provide a small sample project, that would be best. It would help us reproduce the problem and find an appropriate solution significantly faster.

                                Best regards,
                                Vladimir