<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFFILE</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="説明">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFFILE</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">説明</span>
<p>
サーバーファイルとの操作を管理します。 
</p>

<p>
次のセクションでは、cffile タグのアクションについて説明します。
</p>
<ul>

<li>127ページのcffile action = &quot;append&quot;</li>

<li>129ページのcffile action = &quot;copy&quot;</li>

<li>131ページのcffile action = &quot;delete&quot;</li>

<li>132ページのcffile action = &quot;move&quot;</li>

<li>134ページのcffile action = &quot;read&quot;</li>

<li>136ページのcffile action = &quot;readBinary&quot;</li>

<li>137ページのcffile action = &quot;rename&quot;</li>

<li>139ページのcffile action = &quot;upload&quot;</li>

<li>142ページのcffile action = &quot;write&quot;</li>
</ul>
<table>
  <tr valign="top">
    <td width="30"><strong>メモ: </strong></td>
    <td>このタグを実行するには、ColdFusion Administrator でタグを有効にする必要があります。詳細については、『ColdFusion&#160;MX の設定と管理』 を参照してください。</td>
  </tr>
</table>
<p>
複数のカスタマが使用するサーバーで ColdFusion アプリケーションを実行する場合、アップロード可能または cffile で操作できるファイルについて、セキュリティを考慮する必要があります。詳細については、『ColdFusion&#160;MX の設定と管理』 を参照してください。
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">カテゴリ</span>
<p>
ファイル管理タグ
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">シンタックス</span>
<p>
タグのシンタックスは action 属性値によって異なります。それぞれの属性値のセクションを参照してください。
</p>
<ul>

<li>cffile action = &quot;append&quot;</li>

<li>cffile action = &quot;copy&quot;</li>

<li>cffile action = &quot;delete&quot;</li>

<li>cffile action = &quot;move&quot;</li>

<li>cffile action = &quot;read&quot;</li>

<li>cffile action = &quot;readBinary&quot;</li>

<li>cffile action = &quot;rename&quot;</li>

<li>cffile action = &quot;upload&quot;</li>

<li>cffile action = &quot;write&quot;</li>
</ul>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">関連項目</span>
<p>
cfdirectory
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">ヒストリ</span>
<p>
ColdFusion&#160;MX&#160;7: result 属性が追加されました。この属性では、結果パラメータを受け取る代替変数を指定することができます。action = &quot;upload&quot; アクションの場合に使用します。
</p>

<p>
ColdFusion MX&#160;6.1: 
</p>
<ul>

<li>ファイルパスの必要条件が変更されました。絶対パスを指定しなかった場合は、GetTempDirectory 関数から返される ColdFusion のテンポラリディレクトリを基準とした相対パスになります。</li>

<li>action=&quot;read&quot; の動作が変更されました。BOM (Byte Order Mark) で始まるファイルの場合は、ColdFusion がそれを使って文字エンコードを判別します。</li>

<li>action=&quot;upload&quot; nameConflict=&quot;MakeUnique&quot; の動作が変更されました。ColdFusion はファイル名の最後に増分番号を付加することで、固有の名前を作成します (1 番めのファイルには 1 を付け、2 番めのファイルには 2 を付ける、という具合です)。ColdFusion MX では、各ファイルの名前に &quot;1&quot; を付加することで固有の名前を作成していました (つまり、1、11、111、という具合です)。</li>
</ul>

<p>
ColdFusion&#160;MX:
</p>
<ul>

<li>パス内のスラッシュの使い方が変更されました。UNIX システムでも Windows システムでも、パス内にスラッシュ (/) または円記号 () を使用することができます。</li>

<li>ファイル階層の必要条件が変更されました。このタグで操作するファイルやディレクトリを、Web サーバーのドキュメントディレクトリのルートの下に置く必要はありません。 </li>

<li>destination 属性のディレクトリパスの必要条件が変更されました。destination 属性で指定するディレクトリパスには、円記号を付ける必要はありません。 </li>

<li>attributes 属性の system 値が使用禁止になりました。 </li>

<li>attributes 属性の temporary 値が使用禁止になりました。ColdFusion MX では、これは normal と同義です。このタグは、これ以降のリリースでは機能しない可能性があります。 </li>

<li>action 属性の read、write、append、move オプションが変更されました。これらのオプションは、charset という新しい属性をサポートします。</li>

<li>attributes 属性の archive 値は現在使われておらず、効果はありません。</li>
</ul>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">例</span><pre>&lt;!--- この例では、CFFILE を使用してファイルの書き込み、読み込み、更新、および削除を行う方法を説明します。
この例は参照専用です。 ---&gt;
&lt;!--- 
&lt;cfif IsDefined(&quot;form.formsubmit&quot;) is &quot;Yes&quot;&gt; 
   &lt;!--- フォームが送信されたため、ここでアクションを実行します。 ---&gt; 
   &lt;cfif form.action is &quot;new&quot;&gt; 
      &lt;!--- 新しいファイルを作成 ---&gt; 
      &lt;cffile          action=&quot;Write&quot; 
         file=&quot;#GetTempDirectory()#foobar.txt&quot;
         output=&quot;#form.the_text#&quot;&gt; 
   &lt;/cfif&gt; 
   &lt;cfif form.action is &quot;read&quot;&gt; 
      &lt;!--- 既存のファイルを読み込み ---&gt; 
      &lt;cffile          action=&quot;Read&quot; 
            file=&quot;#GetTempDirectory()#foobar.txt&quot;
            variable=&quot;readText&quot;&gt; 
   &lt;/cfif&gt; 

   &lt;cfif form.action is &quot;add&quot;&gt; 
      &lt;!--- 既存のファイルを更新 ---&gt; 
      &lt;cffile          action=&quot;Append&quot; 
         file=&quot;#GetTempDirectory()#foobar.txt&quot;
         output=&quot;#form.the_text#&quot;&gt; 
   &lt;/cfif&gt; 

   &lt;cfif form.action is &quot;delete&quot;&gt; 
      &lt;!--- 既存のファイルを削除 ---&gt; 
      &lt;cffile       action=&quot;Delete&quot; 
         file=&quot;#GetTempDirectory()#foobar.txt&quot;&gt; 
   &lt;/cfif&gt; 
&lt;/cfif&gt; 
&lt;!--- いくつかの変数を設定します。 ---&gt; 
&lt;cfparam    name=&quot;fileExists&quot;    default=&quot;no&quot;&gt; 
&lt;cfparam name=&quot;readText&quot; default=&quot;&quot;&gt; 
&lt;!--- 最初に、あらかじめ用意したファイルがあるかどうかを確認します。 ---&gt; 
&lt;cfif FileExists(&quot;#GetTempDirectory()#foobar.txt&quot;) is &quot;Yes&quot;&gt; 
   &lt;cfset fileExists=&quot;yes&quot;&gt; 
&lt;/cfif&gt; 
&lt;!--- ここで、この例を実行するフォームを作成します。 ---&gt; 
&lt;form action=&quot;index.cfm&quot; method=&quot;POST&quot;&gt; 
&lt;h4&gt;ファイルに挿入するテキストを入力します。&lt;/h4&gt; &lt;p&gt;
&lt;cfif fileExists is &quot;yes&quot;&gt; 
   &lt;p&gt;ファイル foobar.txt は &lt;cfoutput&gt;#GetTempDirectory()#&lt;/cfoutput&gt; に存在します。 
   このファイルに追加したり、このファイルから読み取ったり、ファイルを削除したりすることができます。&lt;/p&gt;
&lt;/cfif&gt; 
&lt;!--- フォームから読み取る場合、その情報をテキストエリアに表示します。 ---&gt; 
&lt;textarea name=&quot;the_text&quot; cols=&quot;40&quot; rows=&quot;5&quot;&gt; 
   &lt;cfif readText is not &quot;&quot;&gt; 
      &lt;cfoutput&gt;#readText#&lt;/cfoutput&gt; 
   &lt;/cfif&gt;&lt;/textarea&gt; 
&lt;!--- ファイルが存在するかどうかに応じて、アクションを選択します。 ---&gt; 
&lt;select name=&quot;action&quot;&gt; 
&lt;cfif fileExists is &quot;no&quot;&gt; 
   &lt;option value=&quot;new&quot;&gt;新しいファイルを作成 
&lt;/cfif&gt; 
&lt;cfif fileExists is &quot;yes&quot;&gt; 
   &lt;option value=&quot;add&quot;&gt;既存のファイルに追加 
   &lt;option value=&quot;delete&quot;&gt;ファイルを削除 
   &lt;option value=&quot;read&quot;&gt;既存のファイルを読み込み 
&lt;/cfif&gt; 
&lt;/select&gt; 
&lt;input type=&quot;Hidden&quot; name=&quot;formsubmit&quot; value=&quot;yes&quot;&gt; 
&lt;input type=&quot;Submit&quot; name=&quot;&quot; value=&quot;変更&quot;&gt; 
&lt;/form&gt; ---&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>

  </body>
</html>
