ファイルを必要とするRESTful Webサービスと対話しようとしています。ファイルパスではなくファイル名のみを表示するには、ファイルparamでCFHTTPを取得するにはどうすればよいですか?
フィールド名をデータに設定し(APIの必要に応じて)、ファイルを絶対パスとして指定します。ファイルがサーバーに送信されると、HTTPトランザクションのファイル名は完全な絶対パスになります。
フルパスが "FileName"として記録されるため、APIに問題が発生します。
フルパスではなくファイル名のみをレポートするようにColdFusionを設定するにはどうすればよいですか?私たちは、ここでのColdFusion 9
を使用している
は、CFMLです:
CFHTTP 9
-------------------------------7d0d117230764
Content-Disposition: form-data; name="data"; filename="c:\temp\testfile.txt"
Content-Type: text/plain
This is the text, really long, well, not really.
-------------------------------7d0d117230764--
IE8
-----------------------------7db370d80e0a
Content-Disposition: form-data; name="FileField"; filename="C:\temp\testfile.txt"
Content-Type: text/plain
This is the text, really long, well, not really.
-----------------------------7db370d80e0a--
Chrome 13
------WebKitFormBoundaryDnpFVJwCsZkzTGDc
Content-Disposition: form-data; name="FileField"; filename="testfile.txt"
Content-Type: text/plain
This is the text, really long, well, not really.
Firefox 6
-----------------------------22798303036224
Content-Disposition: form-data; name="FileField"; filename="testfile.txt"
Content-Type: text/plain
This is the text, really long, well, not really.
-----------------------------22798303036224--
どうやらIE8とCFHTTP両方:ここ
<cfhttp url="http://server/testcode"
port="9876"
method="post"
result="Content">
<cfhttpparam type="file"
name="data"
file="c:\temp\testfile.txt">
</cfhttp>
は、異なるブラウザとHTTPの相互作用の例をいくつか示します。同じことを行います(ファイル名に "c:\ temp"を追加してください)。私はHTTPの仕様は何か分かりませんが、CFHTTPにパスを残す方法があればうれしいでしょう。
これを行う方法はありますか?
一部のコードを投稿することはできますか?APIが期待しているデータの種類(バイナリ、文字列)も理解できませんか? –
'httpparam'のタイプをfileに設定していて、file属性を使用していますか? –