Hi all!!!
This is my first post here so please feel free to move if it's in the wrong place :-)
Ok, i am just starting out in web development, and i have created a data entry form in DW CS3 and succesfully link it into MySQL (big deal for me!), the problems is i cannot get images to upload to the database. I am using CF locally and MySQL is also on the development machine.
So here's what i've got so far
<cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
<cfquery datasource="affinity">
INSERT INTO vehicle_details (vehicle_description, contract_details, available_to, deposit, business_price, personal_price, additional_infomation, manufacturer)
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.available_to") AND #FORM.available_to# NEQ "">
<cfqueryparam value="#FORM.available_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>
)
</cfquery>
<cflocation url="adminwelcome.cfm">
</cfif>
<!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>admin inside</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
color: #999999;
}
body {
background-color: #FFFFFF;
background-image: url(images/Background_Affinity.jpg);
background-repeat: no-repeat;
}
#container {
width: 900px;
margin-top: 60px;
margin-right: auto;
margin-left: auto;
}
#container #form1 #button2 {
float: right;
}
-->
</style>
</head>
<body>
<div id="container">
<form id="form1" name="form1" method="POST" action="<cfoutput>#CurrentPage#</cfoutput>">
<table width="582" border="0" cellpadding="2">
<tr>
<td width="151">Vehicle Description</td>
<td width="230"><label>
<input type="text" name="vehicle_description" id="vehicle_description" />
</label></td>
<td width="181"><label>
<input type="button" name="button5" id="button5" value="Help!" />
</label></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>Available To</td>
<td><label>
<input type="text" name="available_to" id="available_to" />
</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>Additional Info</td>
<td><label>
<input type="text" name="additional_infomation" id="additional_infomation" />
</label></td>
<td> </td>
</tr>
<tr>
<td height="27">Manufacturer</td>
<td><label>
<input type="text" name="manufacturer" id="manufacturer" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Image</td>
<td><input name="userfile[]2" type="file" /></td>
<td> </td>
</tr>
<tr>
<td>Brochure</td>
<td><label>
<input name="userfile[]" type="file" />
</label></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input type="submit" name="Submit" id="button" value="Save Vehicle " /></td>
<td><label>
<input type="button" name="button2" id="button2" value="Cancel" onclick="history.back()" />
</label></td>
<td> </td>
</tr>
<tr>
<td><label>
<input type="submit" name="button6" id="button6" value="Delete Vehicle" />
</label></td>
<td> </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>
So i'm thinking i must be missing a small command somewhere, but as i say i am a novice so if anyone out there can help me i'd be very grateful!!
Hope to hear from someone soon :-)
Thanks in advance!!