VB
Protected Sub Button1_Click(ByVal sender
As Object, ByVal e As System.EventArgs)
If FileUpload1.HasFile Then
Try
FileUpload1.SaveAs("C:\Uploads\" &
FileUpload1.FileName)
Label1.Text="File name: "&
FileUpload1.PostedFile.FileName & "
" &
"File Size: " & _
FileUpload1.PostedFile.ContentLength & " kb
" &
"Content type: " &
FileUpload1.PostedFile.ContentType
Catch ex As Exception
Label1.Text="ERROR: "& ex.Message.ToString()
End Try
Else
Label1.Text="You have not specified a file."
End If
End Sub
FileUpload Server Control
OnClick="Button1_Click"/>