This is a migrated thread and some comments may be shown as answers.

RadUpload File Count Always Zero

1 Answer 290 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 10 Jun 2014, 05:03 AM
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

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 10 Jun 2014, 07:09 AM
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.

 
Tags
Upload (Obsolete)
Asked by
L
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or