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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.