<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 = "UPLOAD" </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 = "UPLOAD" </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>
  <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;upload&quot;
   fileField = &quot;formfield&quot;
   destination = &quot;full_path_name&quot;
   nameConflict = &quot;behavior&quot;
   accept = &quot;mime_type&quot;、&quot;file_type&quot;
   mode = &quot;permission&quot;
   attributes = &quot;file_attribute_or_list&quot;&gt;
   result = &quot;result_name&quot;
</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>
ファイルのアップロードが終了すると、ファイルアップロードのパラメータを使用してステータス情報を取得できます。パラメータを参照するには、cffile 接頭辞を使用するか、result 属性で代替名を指定した場合はその指定した名前を使用します。たとえば、result 属性で名前を指定しなかった場合は、#cffile.fileExisted# として  fileExisted パラメータにアクセスします。result 属性を myResult に設定した場合は、#myResult.fileExisted# として fileExisted パラメータにアクセスします。 
</p>

<p>
ステータスパラメータは、他の ColdFusion パラメータを使用できる場所であればどこでも使用できます。 
</p>
<table>
  <tr valign="top">
    <td width="30"><strong>ヒント: </strong></td>
    <td>result 属性では、複数のページから同時に呼び出される関数または CFC について、一方の呼び出しの結果が他方の呼び出しの結果を上書きしないようにすることができます。</td>
  </tr>
</table><table>
  <tr valign="top">
    <td width="30"><strong>メモ: </strong></td>
    <td>cffile 接頭辞を優先するために、file 接頭辞は使用禁止になりました。新規アプリケーションでは file 接頭辞を使用しないでください。</td>
  </tr>
</table><table>
  <tr valign="top">
    <td width="30"><strong>ヒント: </strong></td>
    <td>ページのフォーム上で選択されたファイルまたは multipart/form-data HTTP メッセージ経由でページに送信されたファイルをアップロードする場合には、CGI.content_length 変数の値を調べれば、ファイルのおおよそのサイズがわかります。この変数には、ファイルの長さだけでなく、その他のリクエストコンテンツの長さも格納されています。</td>
  </tr>
</table>
<p>
アップロードを終えた後は、次に示すファイルアップロードステータスのパラメータを使用できます。
</p>

<p>
</p><div align="left">
<table border="1">
  <caption></caption>
  <tr align="center">    <th><strong>パラメータ</strong></th>
    <th><strong>説明</strong></th>
</tr>
  <tr align="left">    <td>
<p>attemptedServerFile</p></td>
    <td>
<p>ファイルを保存するために使用された初期名です。</p></td>
</tr>
  <tr align="left">    <td>
<p>clientDirectory</p></td>
    <td>
<p>クライアントのシステムからアップロードされたファイルのディレクトリ位置です。</p></td>
</tr>
  <tr align="left">    <td>
<p>clientFile</p></td>
    <td>
<p>クライアントのシステムからアップロードされたファイルの名前です。</p></td>
</tr>
  <tr align="left">    <td>
<p>clientFileExt</p></td>
    <td>
<p>クライアントシステム上のアップロードされたファイルの拡張子です (ピリオドは含みません)。</p></td>
</tr>
  <tr align="left">    <td>
<p>clientFileName</p></td>
    <td>
<p>クライアントシステム上のアップロードされたファイルの名前です (拡張子は含みません)。</p></td>
</tr>
  <tr align="left">    <td>
<p>contentSubType</p></td>
    <td>
<p>保存ファイルの MIME コンテンツサブタイプです。</p></td>
</tr>
  <tr align="left">    <td>
<p>contentType</p></td>
    <td>
<p>保存ファイルの MIME コンテンツタイプです。</p></td>
</tr>
  <tr align="left">    <td>
<p>dateLastAccessed</p></td>
    <td>
<p>アップロードされたファイルが最後にアクセスされた日付と時刻です。</p></td>
</tr>
  <tr align="left">    <td>
<p>fileExisted</p></td>
    <td>
<p>同じパスを持つファイルが既に存在しているかどうかを yes または no で示します。</p></td>
</tr>
  <tr align="left">    <td>
<p>fileSize</p></td>
    <td>
<p>アップロードされたファイルのサイズです。</p></td>
</tr>
  <tr align="left">    <td>
<p>fileWasAppended</p></td>
    <td>
<p>アップロードされたファイルが他のファイルに追加されたかどうかを yes または no で示します。</p></td>
</tr>
  <tr align="left">    <td>
<p>fileWasOverwritten</p></td>
    <td>
<p>ファイルが上書きされたかどうかを yes または no で示します。</p></td>
</tr>
  <tr align="left">    <td>
<p>fileWasRenamed</p></td>
    <td>
<p>名前の重複を回避するために、アップロードされたファイルの名前が変更されたかどうかを yes または no で示します。</p></td>
</tr>
  <tr align="left">    <td>
<p>fileWasSaved</p></td>
    <td>
<p>ファイルが保存されたかどうかを yes または no で示します。</p></td>
</tr>
  <tr align="left">    <td>
<p>oldFileSize</p></td>
    <td>
<p>ファイルのアップロード処理によって上書きされたファイルのサイズです。</p></td>
</tr>
  <tr align="left">    <td>
<p>serverDirectory</p></td>
    <td>
<p>サーバー上に実際に保存されたファイルのディレクトリです。</p></td>
</tr>
  <tr align="left">    <td>
<p>serverFile</p></td>
    <td>
<p>サーバー上に保存されたファイルの名前です。</p></td>
</tr>
  <tr align="left">    <td>
<p>serverFileExt</p></td>
    <td>
<p>サーバー上にアップロードされたファイルの拡張子です (ピリオドは含みません)。</p></td>
</tr>
  <tr align="left">    <td>
<p>serverFileName</p></td>
    <td>
<p>サーバー上にアップロードされたファイルの名前です (拡張子は含みません)。</p></td>
</tr>
  <tr align="left">    <td>
<p>timeCreated</p></td>
    <td>
<p>アップロードされたファイルが作成された時刻です。</p></td>
</tr>
  <tr align="left">    <td>
<p>timeLastModified</p></td>
    <td>
<p>アップロードされたファイルが最後に修正された日付と時刻です。</p></td>
</tr>
</table>
</div>
<p>
</p>
<table>
  <tr valign="top">
    <td width="30"><strong>メモ: </strong></td>
    <td>ファイルステータスのパラメータは読み取り専用です。これらのパラメータには、最新の cffile オペレーションの結果が設定されます。2 つの cffile タグを実行すると、result 属性で異なる結果変数を指定していない限り、最初の結果は 2 番めの結果によって上書きされます。</td>
  </tr>
</table>    </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>
次の例では、Windows 上でのファイルアップロード時に名前が競合している場合に、固有のファイル名を作成します。 
</p>
<pre>&lt;!--- Windows の例 ---&gt;
&lt;!--- フォーム変数が存在するかどうかを確認します。 ---&gt;
&lt;cfif isDefined(&quot;Form.FileContents&quot;) &gt;
   &lt;!--- TRUE の場合、ファイルをアップロードします。 ---&gt;
   &lt;cffile action = &quot;upload&quot; 
      fileField = &quot;FileContents&quot; 
      destination = &quot;c:filesupload&quot; 
      accept = &quot;text/html&quot; 
      nameConflict = &quot;MakeUnique&quot;&gt;
&lt;cfelse&gt;
   &lt;!--- FALSE の場合、フォームを表示します。 ---&gt;
   &lt;form method=&quot;post&quot; action=&lt;cfoutput&gt;#cgi.script_name#&lt;/cfoutput&gt; 
      name=&quot;uploadForm&quot; enctype=&quot;multipart/form-data&quot;&gt;
      &lt;input name=&quot;FileContents&quot; type=&quot;file&quot;&gt;
      &lt;br&gt;
      &lt;input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Upload File&quot;&gt; 
   &lt;/form&gt;
&lt;/cfif&gt;
</pre>
         </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="FILEFIELD">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">FILEFIELD</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>フィールド名を指定するときにシャープ記号 (#) を使用しないでください。 </p>

  </td>
  </tr>
  </table>
</div>
<div id="DESTINATION">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DESTINATION</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>ファイルのアップロード先となるディレクトリのパス名です。絶対パス (ドライブ文字とコロン、あるいはスラッシュまたは円記号から始まるパス) を指定しなかった場合は、GetTempDirectory 関数から返される ColdFusion テンポラリディレクトリを基準とする相対パスになります。</p>

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


<p>ファイル名がディレクトリ内のファイルと同じ場合に実行するアクションです。</p><ul>

<li>Error: ファイルは保存されません。ColdFusion によりページの処理が停止され、エラーが返されます。</li>

<li>Skip: ファイルは保存されません。このオプションでは、ファイルプロパティに基づいて、動作をカスタマイズできます。</li>

<li>Overwrite: ファイルを上書きします。</li>

<li>MakeUnique: アップロード用に固有のファイル名を作成します。この名前は、file オブジェクト変数 serverFile に保管されます。 </li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="ACCEPT">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">ACCEPT</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>受け入れる MIME タイプを制限します。カンマで区切って指定します。たとえば、JPEG ファイルと Microsoft Word ファイルのアップロードを許可するには、次のように指定します。</p>
<p>accept = &quot;image/jpg, application/msword&quot;</p>
<p>ブラウザは、ファイル拡張子に基づいてファイルタイプを判別します。</p>

  </td>
  </tr>
  </table>
</div>
<div id="MODE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">MODE</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>UNIX および Linux だけに適用されます。許可を表す UNIX chmod コマンドの 8 進数値です。所有者、グループ、および他の利用者それぞれに割り当てられます。例 : </p><ul>

<li>644: 所有者に読み取り/書き込み許可、グループおよび他の利用者に読み取り許可を割り当てます。</li>

<li>777: 利用者全員に読み取り/書き込み/実行許可を割り当てます。</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="ATTRIBUTES">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">ATTRIBUTES</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>Windows に適用されます。ファイルに設定する属性をカンマ区切りリストで指定します。</p>
<p>この属性を省略した場合、ファイルの属性が保持されます。</p>
<p>値はそれぞれ明示的に指定する必要があります。たとえば、attributes = &quot;readOnly&quot; を指定した場合、他の属性がすべて上書きされます。 </p><ul>

<li>readOnly</li>

<li>hidden</li>

<li>normal (normal 以外に他の属性が指定されている場合、normal よりも他の属性が優先されます)</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="RESULT">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">RESULT</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>cffile が結果またはステータスのパラメータを返す変数の名前を指定することができます。この属性の値を指定しない場合、cffile は `cffile' という接頭辞を使用します。詳細については、「使用方法」を参照してください。</p>

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

  </body>
</html>
