Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Image

Status
Not open for further replies.

krichard

Technical User
Dec 5, 2001
41
US
Hello...

I have a form that inserts data with an option to insert an image... is there some code that allows you to insert a default no image file incase they leave the image field blank?


<cfset file1 = #CFFILE.serverfile#>
<cfset img_path = 'Images/gallery/Items/#file1#'>


<CFQUERY name=&quot;insertrequest&quot; DATASOURCE=&quot;#request.dsn#&quot;>
Insert Into ItemDirectory
(

Item,
Description,
Image

)
values
(
'#form.Item#',
'#form.Description#',
'#img_path#'

)
</CFQUERY>
 
You would want to do something like:

Code:
<CFPARAM name=&quot;file1&quot; default=&quot;none.gif&quot;>

<CFIF IsDefined(&quot;CFFILE.serverfile&quot;) AND Len(Trim(CFFILE.serverfile)) GT 0>
  <CFSET file1 = CFFILE.serverfile>
</CFIF>

<CFSET img_path = &quot;Images/gallery/Items/#file1#&quot;>         
      :

-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top