RadUpload File Count Always Zero

Thread is closed for posting
2 posts, 0 answers
  1. L
    L avatar
    298 posts
    Member since:
    Apr 2008

    Posted 10 Jun 2014 Link to this post


    I am always getting file count 0 and i don't know why? Is there anything i need to add in the web config file? Or is there anything that i may have missed? Please help. Thanks a lot

    <telerik:RadAsyncUpload ID="upload" runat="server" AllowedFileExtensions="jpg,png,gif" Skin="Metro" InputSize="50">
                                    <Localization Select="Browse" />

    Protected Sub btnUpload_Click(sender As Object, e As EventArgs) Handles btnUpload.Click
            Dim stdWidth As Integer
            Dim stdHeight As Integer
            Dim filenameext As String = "None"
                Dim i As Integer = upload.UploadedFiles.Count
                If upload.UploadedFiles.Count > 0 Then
                    For Each f As UploadedFile In upload.UploadedFiles
                        Dim filename As String = Session("accountid").Replace("-", "0")
                        Dim target As String = Server.MapPath(filename)
                        Dim filepath As String = "~/images/pic" & filename
                        If Not Directory.Exists(target) Then
                        End If

                        Using originalimage As New Bitmap(f.InputStream)

                            Dim NewSize As System.Drawing.Size = New System.Drawing.Size(stdWidth, stdHeight)
                            Dim newimg As New Bitmap(NewSize.Width, NewSize.Height, PixelFormat.Format16bppRgb555)
                            Dim g As Graphics = Graphics.FromImage(newimg)
                            g.InterpolationMode = InterpolationMode.HighQualityBicubic
                            g.CompositingQuality = CompositingQuality.HighQuality
                            g.SmoothingMode = SmoothingMode.HighQuality
                            g.DrawImage(originalimage, New Rectangle(0, 0, 120, 120))
                            newimg.Save(Path.Combine(Server.MapPath(filepath), filename + f.GetExtension))

                        End Using
                    filenameext = "None"
                End If
            Catch ex As Exception
            End Try
        End Sub
  2. Plamen
    Plamen avatar
    2926 posts

    Posted 10 Jun 2014 Link to this post


    In case when RadAsyncUpload is used instead of using For Each for the UploadedFiles of the control in the button click event we recommend using the OnFileUploaded event which is thrown for every uploaded file.

    Hope this information will help you solve the issue.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top