Uploading Images

I am upgrading my current website to be able to upload two images to the website so visitors can see the product they may be purchasing. I am using the asp.net 2.0 in vb.net. I would like to use the file upload that is provided. However, when that file is uploaded, I want it to upload to my server and not my sql database. The column in the sql database will have the link to that file.  I have searched all over and haven't been able to find a way to do this or if it is even more efficient to do it in this way. To clarify more, this is what I am looking to do:

User uploads an image to my server.
The image is stored in a file folder on my server
A link to the image is stored in a column in my sql database.

Note: If it is more efficient, I could store the image in the database itself.  Thanks for any help you can provide.
Who is Participating?
mhf1364Connect With a Mentor Commented:
use file_Base like = "~/images/"

Public Function Upload_File(ByVal UpldCtrl As FileUpload, ByVal File_Base As String) As String 
Dim Filename As String = "" 
Dim File_ex As String = "" 
If UpldCtrl.HasFile Then 
Filename = UpldCtrl.FileName 
UpldCtrl.SaveAs(Server.MapPath(File_Base) & Filename) 
Catch ex As Exception 
Filename = "" 
End Try 
End If 
Return Filename 
End Function 

Open in new window

Wouldn't simply performing an SQL query to your database, retrieving the url you stored in the row and then setting the image location to a dynamic variable you populate via an SQL query be easier?
TomMicrosoft ISV PartnerCommented:
If you want to upload images to your server image folder, then I suggest you use
Quteftp  http://www.cuteftp.com/cuteftp/    or something similar to transfer the files.
smitty68521Author Commented:
That is my goal. To populate the sql database column with the link to the image that is stored on the server. Where I am stuck, is how to make that happen. That is to upload the url to the database column to the image that is stored on my server.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.