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=GetFileFromPat
h(GetBaseT
emplatePat
h())>
<cfif IsDefined("FORM.MM_InsertR
ecord") 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_de
scription"
) AND #FORM.vehicle_description#
NEQ "">
<cfqueryparam value="#FORM.vehicle_descr
iption#" cfsqltype="cf_sql_clob" maxlength="200">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.contract_d
etails") AND #FORM.contract_details# NEQ "">
<cfqueryparam value="#FORM.contract_deta
ils#" 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_p
rice") AND #FORM.business_price# NEQ "">
<cfqueryparam value="#FORM.business_pric
e#" cfsqltype="cf_sql_clob" maxlength="45">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.personal_p
rice") AND #FORM.personal_price# NEQ "">
<cfqueryparam value="#FORM.personal_pric
e#" cfsqltype="cf_sql_clob" maxlength="45">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.additional
_infomatio
n") AND #FORM.additional_infomatio
n# NEQ "">
<cfqueryparam value="#FORM.additional_in
fomation#"
cfsqltype="cf_sql_clob" maxlength="45">
<cfelse>
''
</cfif>
, <cfif IsDefined("FORM.manufactur
er") 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>#Current
Page#</cfo
utput>" method="POST" enctype="multipart/form-da
ta" 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"> </td>
</tr>
<tr>
<td>Manufacturer</td>
<td><label>
<input type="text" name="manufacturer" id="manufacturer" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Contract Details</td>
<td><label>
<input type="text" name="contract_details" id="contract_details" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Additional Infomation</td>
<td><label>
<input type="text" name="additional_infomatio
n" id="additional_infomation"
/>
</label></td>
<td> </td>
</tr>
<tr>
<td>Deposit</td>
<td><label>
<input type="text" name="deposit" id="deposit" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Business Price</td>
<td><label>
<input type="text" name="business_price" id="business_price" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Personal Price</td>
<td><label>
<input type="text" name="personal_price" id="personal_price" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Available To</td>
<td><label>
<input type="text" name="availible_to" id="availible_to" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Image</td>
<td><label>
<input type="file" name="image" id="image" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Brochure</td>
<td><label>
<input type="file" name="brochure" id="brochure" />
</label></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="Submit" id="Submit" value="Save Vehicle" />
</label></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </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