Advertisement

07.14.2008 at 06:41AM PDT, ID: 23562502
[x]
Attachment Details

Uploading image file to MySQL via CF8 using data entry form creaed in DW CS3?

Asked by loki421 in MySQL, ColdFusion Application Server, Adobe Creative Suite

Tags: Adobe, Dreamweaver CS3 + CF8, Coldfusion + MySQL, Firefox + IE7

Hi all!
This is my first post here so can i just say hi to all you guys and gals!!! :-)

Ok, so here's the problem, i have a data entry form i created in DW CS3, i am using CF8 and MySQL all hosted locally on my XP laptop.  

All text feilds go to the MySQL database when submitted, but the image files don't go across (i have a browse button for users to upload files from their hard drive).  I've heard that storing images in MySQL is not a good idea, and it's best to send the image to a temp folder in the server then send the image id to MySQL and this will display the correct image with the correct data?  

The problem is i'm a complete novice and don't know my td tags from my hd tags!!!!  It's all been done in design mode so far!  

Does anyone know what i need to do to send the image id to MySQL and the image to CF server?  Now please bear in mind that i'm just starting to learn this stuff so any advice/suggestions need to be very clear :-)

Ok, so here's the code so far:
[code]<cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
  <cfquery datasource="company name">
INSERT INTO vehicle_details (vehicle_description, contract_details, available_to, deposit, business_price, personal_price, additional_infomation, manufacturer, image, brochure)
VALUES (<cfif IsDefined("FORM.vehicle_description") AND #FORM.vehicle_description# NEQ "">
<cfqueryparam value="#FORM.vehicle_description#" cfsqltype="cf_sql_clob" maxlength="200">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.contract_details") AND #FORM.contract_details# NEQ "">
<cfqueryparam value="#FORM.contract_details#" cfsqltype="cf_sql_clob" maxlength="150">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.availible_to") AND #FORM.availible_to# NEQ "">
<cfqueryparam value="#FORM.availible_to#" cfsqltype="cf_sql_clob" maxlength="45">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.deposit") AND #FORM.deposit# NEQ "">
<cfqueryparam value="#FORM.deposit#" cfsqltype="cf_sql_clob" maxlength="45">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.business_price") AND #FORM.business_price# NEQ "">
<cfqueryparam value="#FORM.business_price#" cfsqltype="cf_sql_clob" maxlength="45">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.personal_price") AND #FORM.personal_price# NEQ "">
<cfqueryparam value="#FORM.personal_price#" cfsqltype="cf_sql_clob" maxlength="45">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.additional_infomation") AND #FORM.additional_infomation# NEQ "">
<cfqueryparam value="#FORM.additional_infomation#" cfsqltype="cf_sql_clob" maxlength="45">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.manufacturer") AND #FORM.manufacturer# NEQ "">
<cfqueryparam value="#FORM.manufacturer#" cfsqltype="cf_sql_clob" maxlength="45">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.image") AND #FORM.image# NEQ "">
<cfqueryparam value="#FORM.image#" cfsqltype="cf_sql_clob" maxlength="65535">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.brochure") AND #FORM.brochure# NEQ "">
<cfqueryparam value="#FORM.brochure#" cfsqltype="cf_sql_clob" maxlength="2147483647">
<cfelse>
''
</cfif>
)
  </cfquery>
  <cflocation url="adminwelcome.cfm">
</cfif>
<cfquery name="rsAdmin" datasource="company name">
SELECT vehicle_description, contract_details, available_to, deposit, business_price, personal_price, additional_infomation, manufacturer, image, brochure
FROM vehicle_details
</cfquery>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>insert record</title>
<style type="text/css">
<!--
body,td,th {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: medium;
      color: #666666;
}
body {
      background-color: #FFFFFF;
      background-image: url();
}
#container {
      width: 800px;
      margin-top: 60px;
      margin-right: auto;
      margin-left: auto;
}
-->
</style>
</head>

<body>
<div id="container">
  <form action="<cfoutput>#CurrentPage#</cfoutput>" method="POST" enctype="multipart/form-data" name="form1" id="form1">
    <table width="798" border="0">
      <tr>
        <td width="207">Vehicle Description</td>
        <td width="557"><label>
          <input type="text" name="vehicle_description" id="vehicle_description" />
        </label></td>
        <td width="20">&nbsp;</td>
      </tr>
      <tr>
        <td>Manufacturer</td>
        <td><label>
          <input type="text" name="manufacturer" id="manufacturer" />
        </label></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Contract Details</td>
        <td><label>
          <input type="text" name="contract_details" id="contract_details" />
        </label></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Additional Infomation</td>
        <td><label>
          <input type="text" name="additional_infomation" id="additional_infomation" />
        </label></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Deposit</td>
        <td><label>
          <input type="text" name="deposit" id="deposit" />
        </label></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Business Price</td>
        <td><label>
          <input type="text" name="business_price" id="business_price" />
        </label></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Personal Price</td>
        <td><label>
          <input type="text" name="personal_price" id="personal_price" />
        </label></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Available To</td>
        <td><label>
          <input type="text" name="availible_to" id="availible_to" />
        </label></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Image</td>
        <td><label>
          <input type="file" name="image" id="image" />
        </label></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Brochure</td>
        <td><label>
          <input type="file" name="brochure" id="brochure" />
        </label></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><label>
          <input type="submit" name="Submit" id="Submit" value="Save Vehicle" />
        </label></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
      <input type="hidden" name="MM_InsertRecord" value="form1" />
  </form>
</div>
</body>
</html>[code]

Hope someone out there can help me!  This is the only thing holding this project up and i'd love to get it up and running :-)

Thanks in advance all!!!! :-)Start Free Trial
 
Keywords: Uploading image file to MySQL via CF8…
 
Loading Advertisement...
 
[+][-]07.20.2008 at 05:31PM PDT, ID: 22047540

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 12:42AM PDT, ID: 22048573

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 08:09AM PDT, ID: 22051210

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 08:38AM PDT, ID: 22051511

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 09:37AM PDT, ID: 22052046

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 06:30PM PDT, ID: 22075498

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2008 at 01:12AM PDT, ID: 22158986

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.05.2008 at 05:38PM PDT, ID: 22166339

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MySQL, ColdFusion Application Server, Adobe Creative Suite
Tags: Adobe, Dreamweaver CS3 + CF8, Coldfusion + MySQL, Firefox + IE7
Sign Up Now!
Solution Provided By: zadoc
Participating Experts: 1
Solution Grade: A
 
 
[+][-]08.11.2008 at 03:42AM PDT, ID: 22203108

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628