1

これが尋ねられたことは知っていますが、うまくいく解決策が見つからないようです。

以下を使用してデータを CFC に渡す CFM ページがあります。

<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>

データを受け取る CFC では、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">
...

しかし、私はまだ恐ろしいエラーメッセージを受け取ります...

「フォーム フィールド /data/disk01/opt/coldfusion9/runtime/servers/coldfusion/SERVER-INF/temp/wwwroot-tmp/neotmp5003883285207133802.tmp にファイルが含まれていませんでした。」

StackExchange の指示に従うと ( CFFILE - Uploading a file using a component )

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

エラーは発生しませんが、<CFDUMP>[空の文字列] が表示されます。

何が欠けていますか。

ありがとう。

フィル

4

2 に答える 2

0

cffileスコープを削除することで、それを機能させることができました。

于 2012-12-10T19:20:33.760 に答える
0

あなたの cfc の一部ではないことはわかっていますが、フォームに enctype が設定されていることを確認しましたか?

<cfform action="/upload.cfm" enctype="multipart/form-data">
于 2012-12-10T17:18:03.700 に答える