radupload with RadProgressArea not display name of uploding file

Thread is closed for posting
2 posts, 0 answers
  1. Etech
    Etech avatar
    1 posts
    Member since:
    Mar 2012

    Posted 26 Mar 2012 Link to this post

    Here I try Radupload with RadProgressArea in that facing some of issue 

    1)  mention in AllowedFileExtensions & MaxFileSize is not validating at client side
    2) RadProgressArea  primary progress always 100% not status update and the current file name which is up loding  is not geting
    3) the file is saving at the target folder can not be customize with file name
     here i giving code that i used
    //////////////////////design////////////////////////////////////
    <table>
                    <tr>
                        <td>
                            <telerik:RadProgressManager ID="Radprogressmanager1" runat="server" />
                            <table>
                                <tr>
                                    <td>
                                        <telerik:RadUpload ID="RadUpload1" runat="server"
                                               Skin="Windows7" OverwriteExistingFiles="false"  InitialFileInputsCount="1"
                                                                MaxFileInputsCount="5" AllowedFileExtensions=".doc,.docx,.pdf,.xls,.xlsx,.xps,.txt,.rtf,.jpg,.jpeg,.png,.gif,.tiff"
                                                                
                                            MaxFileSize="5242880" ReadOnlyFileInputs="True" Width="340px">
                                                                  
                                            
                                        </telerik:RadUpload>
                                        <asp:CustomValidator ID="Customvalidator1" runat="server" Display="Dynamic" ClientValidationFunction="validateFiletype"
                                            ValidationGroup="UP">
                        <span style="FONT-SIZE: 11px;">Invalid file extensions. Please select only doc,docx,pdf,xls,xlsx,xps,txt,rtf,jpg,jpeg,png,gif or tiff files.</span>
                                        </asp:CustomValidator>
                                           
                                    </td>
                                </tr>
                            </table>
                            <div class="submitArea11">
                                <asp:LinkButton ID="SubmitButton123" runat="server" CssClass="greenbutton " TabIndex="18"
                                    OnClick="SubmitButton123_Click"  ValidationGroup="UP" ToolTip="Click it to Save the File"><span>Upload files</span></asp:LinkButton>
                                    
                            </div>
                            <telerik:RadProgressArea runat="server" ID="ProgressArea1" Skin="Windows7">
                                <Localization Uploaded="Uploaded"></Localization>
                            </telerik:RadProgressArea>
                        </td>
                    </tr>
                </table>


    /////////////////////////////////////// code////////////////////////////

      Public Function DesignAttachmenttable() As DataTable
            Dim dtattachment As New DataTable("Attachment")
            dtattachment.Columns.Add("Filename")
            dtattachment.Columns.Add("FilePath")
            Return dtattachment
        End Function

     Protected Sub Page_Load1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If IsPostBack And RadUpload1.UploadedFiles.Count > 0 Then
                    HandleUpload()
                End If
                If Not IsPostBack() Then
                    If Not IsPostBack Then
                        ProgressArea1.Localization.UploadedFiles = "Completed Steps: "
                        ProgressArea1.Localization.CurrentFileName = "Step: "
                        ProgressArea1.Localization.TotalFiles = "Total Steps:"
                    End If
    End If
    End Sub

    Protected Sub SubmitButton123_Click(ByVal sender As Object, ByVal e As EventArgs)
            If RadUpload1.UploadedFiles.Count > 0 Then
                If Session("Attachment") Is Nothing Then
                    dtAttachment.Clear()
                    athgrv.DataSource = dtAttachment
                    athgrv.DataBind()
                Else
                    dtAttachment = Session("Attachment")
                    athgrv.DataSource = dtAttachment
                    athgrv.DataBind()
                End If
            End If
        End Sub

        Private Sub UpdateProgressContext(ByVal File As UploadedFile)
            Const total As Integer = 100
            Dim progress As RadProgressContext = RadProgressContext.Current
            progress.Speed = "N/A"


            For i As Integer = 0 To total - 1
                progress.PrimaryTotal = total
                progress.PrimaryValue = 1
                progress.PrimaryPercent = i


                progress.SecondaryTotal = total
                progress.SecondaryValue = i
                progress.SecondaryPercent = i
                progress.CurrentOperationText = File.GetName
                If Not Response.IsClientConnected Then
                    Exit For
                End If
                progress.TimeEstimated = (total - i) * 100
                System.Threading.Thread.Sleep(100)
            Next
        End Sub

        Private Sub HandleUpload()
            For Each file As UploadedFile In RadUpload1.UploadedFiles
                Dim dt As String = DateTime.Now.ToString("MMddyyyy_hhmmss") + "_"
                Fname = dt + file.GetName
                Fpath = Server.MapPath("~/UploadedFiles/") + Fname
                file.SaveAs(Fpath)
                If Session("Attachment") Is Nothing Then
                    Session("Attachment") = DesignAttachmenttable()
                    dtAttachment = Session("Attachment")
                Else
                    dtAttachment = Session("Attachment")
                End If
                Dim dr As Data.DataRow = Nothing
                dr = dtAttachment.NewRow
                dr("Filename") = Fname
                dr("FilePath") = Fpath
                dtAttachment.Rows.Add(dr)
                dtAttachment.AcceptChanges()
                Session("Attachment") = dtAttachment
            Next
        End Sub



     Kindly help with detail example
  2. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 26 Mar 2012 Link to this post

    Etech:

    You can take a close look at the Upload/Client-side Validation online demo. This demo does almost everything that you want to do. It validates on the client-side, restricting to certain file types, and sets a 100mb maximum upload size. And, it offers a Progress Indicator.

    In your code, I do not find the "validateFiletype" Javascript function that you reference with ClientValidationFunction="validateFiletype". Did you add it?

    And, did you specify the maxRequestLength="5242880" setting in your Web.config file to restrict the maximum upload size?.

    Regards,
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top