Nan
can you help me in one more thing , I am using the following code to check the valid .df file , it is executing but not able to alert to the user that it is not a valid pdf file
and AjaxFileUpload control is showing "File Uploaded" which is wrong
how to handle it , can you please help in it
Protected Sub AjaxFileUpload1_OnUploadComplete(ByVal sender As Object, ByVal file As AjaxFileUploadEventArgs) Handles AjaxFileUpload1.UploadComplete
' User can save file to File System, database or in session state
' Validation added to check the taken file is a real pdf file or not
Dim r As New System.IO.BinaryReader(file.GetStreamContents)
Dim fileclass As String = String.Empty
Dim buffer As Byte
buffer = r.ReadByte()
fileclass = buffer.ToString
buffer = r.ReadByte
fileclass &= buffer.ToString
If (fileclass = "3780") Then
bool1 = True
Else
bool1 = False
End If
If bool1 = False Then
Label1.Text = "please Choose a Valid pdf File"
Exit Sub
End If
If Not r Is Nothing Then
r.Dispose()
End If
end sub