Hi,
How to upload a file and save in SQL server using vb.net?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jiteendra SampathiraoPosted Aug 9, 2011, 7:47 AM
Go through this LINK
i hope it'll help you.....
Prasant JinagaPosted Aug 9, 2011, 7:21 AM
Here is the Method to Upload the file
Sub Upload(Source As Object, e As EventArgs)
If Not (myFile.PostedFile Is Nothing) Then
Dim intFileNameLength as Integer
Dim strFileNamePath as String
Dim strFileNameOnly as String
'Logic to find the FileName (excluding the path)
strFileNamePath = MyFile.PostedFile.FileName
intFileNameLength = Instr(1, StrReverse(strFileNamePath), "\")
strFileNameOnly = Mid(strFileNamePath, (Len(strFileNamePath)-intFileNameLength)+2)
myFile.PostedFile.SaveAs("c:\inetpub\wwwroot\yourwebapp\upload\" & strFileNameOnly)
lblMsg.Text = "File Upload Success."
End If
End Sub
Thanks,
Prasant