RadUpload File Count Always Zero

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

    Posted 10 Jun 2014 Link to this post

    hi

    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" />
                                </telerik:RadAsyncUpload>

    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"
            Try
                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
                            Directory.CreateDirectory(Server.MapPath(filepath))
                        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))
                            g.Dispose()
                            originalimage.Dispose()

                        End Using
                    Next
                Else
                    filenameext = "None"
                End If
            Catch ex As Exception
             
            End Try
        End Sub
  2. Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 10 Jun 2014 Link to this post

    Hello,

    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.

    Regards,
    Plamen
    Telerik
     

    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.

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