title: ASP.NET fileupload with database file path insert
body: <p>I'm setting up a photography website for my sister-in-law.  What I'm looking to do is to use the ASP.NET upload control.  I've found another posting which has how to do the file upload side of things.  But, the website is going to have a database backend (SQL Server 2012) and what I want to do is write the filepath (include filename and type) into the database so that when a customer logs in the database will display all of the images that have been assigned to that customer.  So the file location field would hold something like ../images/custName/test.jpg</p>
  
  <p>Anyone got any ideas how to do this?  Another option I thought of was to just store the folder location for that customer and then pull back all images in that folder, but I think this method would be less efficient.</p>
  
  <p>I'm very (very!) new to ASP.NET so any help would be greatly received.  Not too fussed if the solution is in C# or VB.NET (I'm trying to learn both anyway).</p>
  
  <p>UPDATE</p>
  
  <p>Database Schema shown below:</p>
  
  <pre><code>[Cust].[CustImages](
      [ImageID] [int] NOT NULL PK,
      [CustomerId] [int] NOT NULL,
      [ProjectId] [int] NOT NULL,
      [ImageFilePath] [varchar](100) NOT NULL,
  </code></pre>
  
  <p>The CustomerId is a FK from the Customer table so that a customer can only see photographs associated to them.  ProjectId is also a FK to the project table, this table is needed to break the M:M relationship between customer and CustImage.</p>
  
  <p>So what will happen is the photographer will go out and take the pictures, then head home and edit them as required and then upload them to the website, the form they will use will have a list of customers and associated projects.  The photographer will select the customer and project and then upload the images.</p>
  
  <p>After seeing some of the responses, I will create a stored procedure that will take in customerId, ProejectId and ImageFilePath as parameters and insert the details into the database.</p>
  
  <p>What I don't know is how to get the ImageFilePath so that I can then pass it into the stored procedure.</p>
  
  <p>Thanks</p>
  
  <p>Alex</p>