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
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