Hi,
This below code maybe can help you to solve your problem..
======================================
lblwarning.Text = ""
objFile = filUpload.PostedFile
If objFile.ContentLength = Nothing Then
Else
If LCase(Trim(Path.GetExtension(objFile.FileName))) = ".pdf" Or LCase(Trim(Path.GetExtension(objFile.FileName))) = ".doc" Then
con = New SqlConnection(Application("dataconnection"))
con.Open()
Try
strFileName = Path.GetFileName(objFile.FileName)
strFullName = Server.MapPath("documentreference") & "/" & Trim(strjobseekerid) & "/" & strFileName
If File.Exists(strFullName) Then
File.Delete(strFullName)
End If
objFile.SaveAs(strFullName)
strsql = "INSERT INTO tbdocumentseeker (jobseekerid,filename) VALUES ('" & strjobseekerid & "','" & strFileName & "') "
cmd = New SqlCommand(strsql, con)
cmd.ExecuteNonQuery()
Catch er As Exception
'Response.Write(er.ToString & "
")
End Try
con.Close()
Else
lblwarning.Text = "Please select a .pdf file."
End If
Call procBindDocumentList()
End If
Good Luck :)
Carpe Diem