1

I know this has been asked, but I cannot seem to find the solution that works.

I have a CFM page that uses the following to pass data to a CFC

<cfinvoke 
component="common.cfcs.geotrails"
method="UpdateGeoTrail">
<cfinvokeargument name="title" value="#form.title#"/>
<cfinvokeargument name="Description_short" value="#form.Description_short#"/>
<cfinvokeargument name="Description" value="#form.description#"/>
<cfinvokeargument name="GTID" value="#form.gtid#"/>
<cfinvokeargument name="CatID" value="#form.catid#"/>
<cfif structKeyExists(form,"fileUpload") and len(form.fileUpload)>
<cfinvokeargument name="fileUpload" value="#form.fileUpload#"/>
</cfif>
</cfinvoke>

In the CFC that receives the data, I followed the direction at the Adobe Cookbook

<cffunction name="UpdateGeoTrail" access="public" returntype="void">
<cfargument name="title" type="string" required="yes">
<cfargument name="Description_short" type="string" required="yes">
<cfargument name="Description" type="string" required="yes">
<cfargument name="GTID" type="numeric" required="yes">
<cfargument name="CatID" type="numeric" required="yes">
<cfargument name="fileUpload" type="string" required="no">

<!--- IF THE IMAGE HAS BEEN UPLOADED --->
<!--- set the full path to the images folder --->
<cfif isdefined("arguments.fileUpload") AND len(arguments.fileUpload)>
<cfset tempmediapath = "#expandPath('/')#media/gtimages/temp/">
<cfset mediapath = "#expandPath('/')#media/gtimages/">

<cfset var cffile = "">
<cffile action="upload"
filefield="#ARGUMENTS.fileUpload#"
destination="#TempMediaPath#"
nameconflict="makeunique">
...

But I still get the dreaded error message...

"The form field /data/disk01/opt/coldfusion9/runtime/servers/coldfusion/SERVER-INF/temp/wwwroot-tmp/neotmp5003883285207133802.tmp did not contain a file."

If I follow the directions at StackExchange ( CFFILE - Uploading a file using a component )

<cffile action="upload"
filefield="fileUpload"
destination="#TempMediaPath#"
nameconflict="makeunique">

It passes without error, but a <CFDUMP> shows: [empty string].

What am I missing.

Thanks.

Phil

Community
  • 1
  • 1
SiriusPhil
  • 149
  • 1
  • 9

2 Answers2

0

I know it isn't part of your cfc but did you make sure that the form has the enctype set?

<cfform action="/upload.cfm" enctype="multipart/form-data">
Lance
  • 3,193
  • 2
  • 32
  • 49
0

By removing the cffile scope, I was able to get it to work.

SiriusPhil
  • 149
  • 1
  • 9