<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 ACTION = "READ"</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 ACTION = "READ"</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>
<ul>

<li>テキストファイルを読み取り、そのファイルの内容をデータベースに挿入します。</li>

<li>テキストファイルを読み取り、検索置換機能を使用してその内容を修正します。</li>
</ul>
<table>
  <tr valign="top">
    <td width="30"><strong>メモ: </strong></td>
    <td>このアクションによって、ファイルがローカル Variables スコープ内の変数に読み込まれます。サーバーがダウンするおそれがあるため、ログなどの大きなファイルには使用しないでください。</td>
  </tr>
</table>  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">シンタックス</span><pre>&lt;cffile
   action = &quot;read&quot;
   file = &quot;full_path_name&quot;
   variable = &quot;var_name&quot;
   charset = &quot;charset_option&quot; &gt;
</pre>    </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>
メインの cffile タグのページの「ヒストリ」を参照してください。
</p>

<p>

</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>
次の例では、ファイル message.txt の内容に対して Message という名前の変数が作成されます。
</p>
<pre>&lt;cffile          action = &quot;read&quot; 
file = &quot;c:webmessage.txt&quot; 
variable = &quot;Message&quot;&gt;
</pre>
<p>
これにより、変数 Message をページ内で使用できます。たとえば、次のようにして最終的な Web ページに &quot;message.txt&quot; ファイルの内容を表示できます。 
</p>
<pre>&lt;cfoutput&gt;#Message#&lt;/cfoutput&gt;
</pre>
<p>
ColdFusion では、テキストファイルの内容を操作するための関数がサポートされています。また、cffile action = &quot;read&quot; オペレーションで作成された変数を ArrayToList 関数や ListToArray 関数で使用することもできます。 
</p>
<table>
  <tr valign="top">
    <td width="30"><strong>メモ: </strong></td>
    <td>Latin-1 文字セットの Windows Cp1252 (windows-1252) エンコードでエンコードされたファイルを、デフォルトの文字エンコードが Cp1252 であるシステム上で cffile タグを使って読み取る場合、そのファイル内に 16 進数の 8x ～ 9x の範囲でエンコードされた文字が含まれているときには、charset=&quot;windows-1252&quot; 属性を指定する必要があります (これはデフォルトのエンコードですが、指定が必要です)。そうしないと、16 進数の 8x ～ 9x の範囲にある一部の文字が正しくマップされず、正しく表示されません。</td>
  </tr>
</table>
         </td>
      </tr>
   </table>
   </div>
<div id="ACTION">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">ACTION</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>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>このタグが実行するファイル操作のタイプです。 </p>

  </td>
  </tr>
  </table>
</div>
<div id="FILE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">FILE</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>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>読み取るファイルのパス名です。</p>
<p>絶対パス (ドライブ文字とコロン、あるいはスラッシュまたは円記号から始まるパス) を指定しなかった場合は、GetTempDirectory 関数から返される ColdFusion テンポラリディレクトリを基準とする相対パスになります。</p>

  </td>
  </tr>
  </table>
</div>
<div id="VARIABLE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">VARIABLE</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>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>テキストファイルの内容が入る変数の名前です。 </p>

  </td>
  </tr>
  </table>
</div>
<div id="CHARSET">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">CHARSET</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>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "文字エンコードは、そのファイルに BOM が存在する場合は BOM により、無い場合は JVM のデフォルトファイル文字セットにより決定します。"


<p>ファイルコンテンツをエンコードする文字エンコードを指定します。一般的に使用される値を次に示します。</p><ul>

<li>utf-8</li>

<li>iso-8859-1</li>

<li>windows-1252</li>

<li>us-ascii</li>

<li>shift_jis</li>

<li>iso-2022-jp</li>

<li>euc-jp</li>

<li>euc-kr</li>

<li>big5</li>

<li>euc-cn</li>

<li>utf-16</li>
</ul>

<p>ファイルが BOM (Byte Order Mark) で始まる場合に、この属性を別の文字エンコードに設定すると、エラーになります。</p>
<p>文字エンコードの詳細については、www.w3.org/International/O-charset.html</a> を参照してください。</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
