Hey guys, complete noob, been trying to figure out how to wrap my head around cffile for a couple of weeks now. I can get a file to upload to the server, even change the name once saved. But i am having problems entering the data into my database.any help would be greatly appreciated...

<cfif structKeyExists(form,"fileUpload") and len(form.fileUpload)>
<cfquery datasource="wpan7608">
INSERT INTO Photos('Photo')
VALUES('#Trim(FORM.Photo)#')
</cfquery>
</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>Upload Photo</title>
<link rel="stylesheet" href="styles/style.css" type="text/css" media="screen" />

<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body class="oneColElsCtr">

<div id="container">
  <div id="mainContent">
  
    <cfinclude template="includes/header.cfm">
    <div id="uploadForm">
    <!---
   Create folder structure or change to fit your needs
   Expects images to be uploaded to images and thumbnails go in thumbs
--->


<!--- set the full path to the images folder --->


<!--- set the desired image height ---->
<cfset thumbsize = 75>

<!--- set the desired image width --->
<cfset imagesize = 320>


<cfif structKeyExists(form,"fileUpload") and len(form.fileUpload)>
   <cfset mediapath = expandpath('./images/#FORM.Name#.jpg')>
   <cffile action="upload"
   filefield="FileUpload"
   destination="#MediaPath#"
   nameconflict="makeunique">
   
   <!--- read the image ---->
   <cfimage name="uploadedImage"
   source="#MediaPath#" >

  
   
   <cfoutput>
      <img src="images/#file.ServerFile#" align="left" hspace="10"><br>

          <a href="images/#file.serverFile#">See Image</a><br>
      
   </cfoutput>
</cfif>   

<cfform action="test_upload_3.cfm" method="post" enctype="multipart/form-data">
   <label for="artist_name">Name image:</label>
   <cfinput type="text" name="artist_name" />
   <label for="fileUpload">Choose Image: </label>
   <cfinput type="file" name="fileUpload">
   <cfinput type="submit" name="UploadImage" value="Upload Image">
   <label for="Photo">Photo name:</label>
   <cfinput type="text" name="Photo" />
</cfform>

 </div>
    
    
	<!-- end #mainContent --></div>
<!-- end #container --></div>
<div id="footer">
<cfinclude template="includes/footer.cfm">
	</div>
</body>
</html>
This article has been dead for over six months. Start a new discussion instead.