Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 3433

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Send file</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.http-send-data.html">http_send_data</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.http-send-last-modified.html">http_send_last_modified</a></div>
 <div class="up"><a href="ref.http.html">HTTP Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.http-send-file" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">http_send_file</h1>
  <p class="verinfo">(PECL pecl_http &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">http_send_file</span> &mdash; <span class="dc-title">Send file</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.http-send-file-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>http_send_file</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$file</code></span>
   )</div>

  <p class="para rdfs-comment">
   Sends a file with support for (multiple) range requests.
  </p>
  <p class="para">
   This functions behaviour and further action is dependent on the following
   <a href="http.configuration.html" class="link">INI setting</a>s:
   <a href="" class="link">http.send.not_found_404</a>
    and <a href="" class="link">http.log.not_found</a>.
  </p>
  <p class="para">
   If the <a href="http.configuration.html" class="link">INI setting</a> <a href="" class="link">http.send.not_found_404</a>
   is enabled and the <a href="http.configuration.html" class="link">INI setting</a> <a href="" class="link">http.log.not_found</a>
   points to a writable file, a log message is written when the <em><code class="parameter">file</code></em> was not found.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.http-send-file-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">file</code></em></span>
     <dd>

      <p class="para">
       the file to send
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.http-send-file-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>


 


 


 <div class="refsect1 examples" id="refsect1-function.http-send-file-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-4374">
    <p><strong>Example #1 A  <span class="function"><strong>http_send_file()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />http_send_content_disposition</span><span style="color: #007700">(</span><span style="color: #DD0000">"document.pdf"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">http_send_content_type</span><span style="color: #007700">(</span><span style="color: #DD0000">"application/pdf"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">http_throttle</span><span style="color: #007700">(</span><span style="color: #0000BB">0.1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2048</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">http_send_file</span><span style="color: #007700">(</span><span style="color: #DD0000">"../report.pdf"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
HTTP/1.1 206 Partial Content
X-Powered-By: PHP/5.2.2
Accept-Ranges: bytes
Content-Length: 12345
Content-Range: bytes 0-12344
Content-Type: application/pdf
Content-Disposition: inline; filename=&quot;document.pdf&quot;

%PDF...
</pre></div>
    </div>
   </div>
  </p>
 </div>



 <div class="refsect1 seealso" id="refsect1-function.http-send-file-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.http-send-data.html" class="function" rel="rdfs-seeAlso">http_send_data()</a> - Send arbitrary data</span></li>
    <li class="member"> <span class="function"><a href="function.http-send-stream.html" class="function" rel="rdfs-seeAlso">http_send_stream()</a> - Send stream</span></li>
    <li class="member"> <span class="function"><a href="function.http-throttle.html" class="function" rel="rdfs-seeAlso">http_throttle()</a> - HTTP throttling</span></li>
    <li class="member"> <span class="function"><a href="function.http-send-content-type.html" class="function" rel="rdfs-seeAlso">http_send_content_type()</a> - Send Content-Type</span></li>
    <li class="member"> <span class="function"><a href="function.http-send-content-disposition.html" class="function" rel="rdfs-seeAlso">http_send_content_disposition()</a> - Send Content-Disposition</span></li>
    <li class="member">the <a href="class.httpresponse.html" class="link">
<a href="class.httpresponse.html" class="classname">HttpResponse</a></a> class if you are using PHP 5.1.0
and above</li>
   </ul>
  </p>
 </div>



</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.http-send-data.html">http_send_data</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.http-send-last-modified.html">http_send_last_modified</a></div>
 <div class="up"><a href="ref.http.html">HTTP Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>