mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-17 21:16:57 +08:00
125 lines
5.1 KiB
HTML
125 lines
5.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<title>Extracts uploaded file embedded in the FDF</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.fdf-get-attachment" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">fdf_get_attachment</h1>
|
|
<p class="verinfo">(PHP 4 >= 4.3.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">fdf_get_attachment</span> — <span class="dc-title">Extracts uploaded file embedded in the FDF</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.fdf-get-attachment-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>fdf_get_attachment</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$fdf_document</code></span>
|
|
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$fieldname</code></span>
|
|
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$savepath</code></span>
|
|
) : <span class="type">array</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Extracts a file uploaded by means of the "file selection" field
|
|
<code class="parameter">fieldname</code> and stores it under
|
|
<code class="parameter">savepath</code>.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.fdf-get-attachment-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">fdf_document</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
The FDF document handle, returned by <span class="function"><a href="fdf_create.html" class="function">fdf_create()</a></span>,
|
|
<span class="function"><a href="fdf_open.html" class="function">fdf_open()</a></span> or <span class="function"><a href="fdf_open_string.html" class="function">fdf_open_string()</a></span>.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">fieldname</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">savepath</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
May be the name of a plain file or an existing directory in which the
|
|
file is to be created under its original name. Any existing file under
|
|
the same name will be overwritten.
|
|
</p>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<p class="para">
|
|
There seems to be no other way to find out the original filename but
|
|
to store the file using a directory as
|
|
<code class="parameter">savepath</code> and check for the basename it was
|
|
stored under.
|
|
</p>
|
|
</p></blockquote>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.fdf-get-attachment-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
The returned array contains the following fields:
|
|
<ul class="itemizedlist">
|
|
<li class="listitem">
|
|
<span class="simpara"><code class="parameter">path</code> - path were the file got stored</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara"><code class="parameter">size</code> - size of the stored file in bytes</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara"><code class="parameter">type</code> - mimetype if given in the FDF</span>
|
|
</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.fdf-get-attachment-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-4151">
|
|
<p><strong>Example #1 Storing an uploaded file</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /> $fdf </span><span style="color: #007700">= </span><span style="color: #0000BB">fdf_open_string</span><span style="color: #007700">(</span><span style="color: #0000BB">$HTTP_FDF_DATA</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$data </span><span style="color: #007700">= </span><span style="color: #0000BB">fdf_get_attachment</span><span style="color: #007700">(</span><span style="color: #0000BB">$fdf</span><span style="color: #007700">, </span><span style="color: #DD0000">"filename"</span><span style="color: #007700">, </span><span style="color: #DD0000">"/tmpdir"</span><span style="color: #007700">);<br /> echo </span><span style="color: #DD0000">"The uploaded file is stored in </span><span style="color: #0000BB">$data</span><span style="color: #007700">[</span><span style="color: #0000BB">path</span><span style="color: #007700">]</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |