Image Upload - Save to MS SQL - Web Form

I am not sure I am looking for the right thing here.. I have an IIS 7.5 web server.. I use Dreamweaver CC to help with my web development.

Here is what I need..

I want a HTML form.. ask some questions.. Name, Phone, few questions then requires a picture be uploaded.  We are using this to have a temp agency fill requests and tell us who they are sending with their picture.  I want to save all this information into my SQL database.

So I figured out how to make a form and select input type "file" ... what I cant find/figure out is how to capture that data on the action "post" and be able to insert it into the MSSQL database.

I user ASP for my SQL/Web stuff.. its what I have figured out and know so I tend to stay with it.

Any guidance is greatly appreciated.
LVL 24
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
You are going to need a component to upload your file to the server.  I personally use for uploading via classic asp.

You will start out with a form similar to below and notice the type  is multipart/form-data

<FORM NAME="MyForm" METHOD="POST" ENCTYPE="multipart/form-data" 


Open in new window

Then on an upload page you capture the uploaded file and data
	Set Upload = Server.CreateObject("Persits.Upload.1")

	Upload.OverwriteFiles = False
	On Error Resume Next

	Upload.SetMaxSize 1048576	' Limit files to 1MB
	Count = Upload.Save("c:\mywebsite\htdocs\uploads")  ' this file should be in your domain and have write permissiosn

For Each File in Upload.Files
     'Response.Write File.Name & "= " & File.Path & " (" & File.Size &" bytes)<BR>"
     theFileName = File.Name
    AddFileNameToDatbase(theFileName) ' run function to add data.

function AddFileNameToDatbase(data)
    ' place your sql to insert data here using theFileName for the name of the file
end function

Open in new window

You have to put your data capture in the for/next.

If you need to capture form data, you can not  use request.form and will need to use Upload.Files("fieldname") instead.  It is documented and that also will need to be inside the for/next statement.  

There are other components that can do the same thing.  They will have different ways for capturing form data as Upload.Files is unique to this product.

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
DMTechGrooupAuthor Commented:
Perfect.. Thanks!
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

From novice to tech pro — start learning today.