Urgent: Upload image to database
I would like to upload an image from the vb.net webform into the database. I am
not using BLOB. Instead I store the image's path name into the database. Can anyone give me an idea on how to upload the image using this method? I had tried searching on google but most of the examples that I fouind is using BLOB.Please help.
I had managed to upload the file to the specific folder but I would like to rename the file upon upload. Below is my code. Can anyone help me on renaming the file upon upload? Thank you
'Check to make sure we actually have a file to upload
If Not (fileUpload1.PostedFile Is Nothing) Then
Dim strLongFilePath As String = fileUpload1.PostedFile.FileName
Dim intFileNameLength As Integer = InStr(1, StrReverse(strLongFilePath), "\")
strFileName = Mid(strLongFilePath, (Len(strLongFilePath) - intFileNameLength) + 2)
Select Case fileUpload1.PostedFile.ContentType
'Make sure we are getting a valid JPG image
Case "image/pjpeg", "image/jpeg"
filepath = Server.MapPath("\") & "\samplelogin\images\upload\"
fileUpload1.PostedFile.SaveAs(filepath & strFileName)
'Not a valid jpeg image
lblMsg.Text = "Not a valid jpeg image"
Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click
uploadSucess = UploadMainImage()
By James Graham in forum .NET
Last Post: 07-17-2013, 12:47 AM
By Arjuna in forum Database
Last Post: 07-25-2007, 04:22 AM
By sandhyaharsh in forum Java
Last Post: 11-15-2005, 07:23 AM
By Ganesh Suryanarayana in forum ASP.NET
Last Post: 08-02-2004, 04:00 PM
By Jeff Pipes in forum VB Classic
Last Post: 11-13-2001, 05:08 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center