docs/class-Psr.Http.Message.UploadedFileInterface.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Interface Psr\Http\Message\UploadedFileInterface | ξ ^ω^)ξ Baguette PHP Mastodon API Client / SDK</title>
<link rel="stylesheet" href="resources/style.css?c2f33731c1948fbed7c333554678bfa68d4817da">
</head>
<body>
<div id="left">
<div id="menu">
<a href="index.html" title="Overview"><span>Overview</span></a>
<div id="groups">
<h3>Namespaces</h3>
<ul>
<li>
<a href="namespace-Baguette.html">
Baguette<span></span>
</a>
<ul>
<li>
<a href="namespace-Baguette.Mastodon.html">
Mastodon<span></span>
</a>
<ul>
<li class="main">
<a href="namespace-Baguette.Mastodon.Config.html">
Config </a>
</li>
<li class="main">
<a href="namespace-Baguette.Mastodon.Entity.html">
Entity </a>
</li>
<li class="main">
<a href="namespace-Baguette.Mastodon.Grant.html">
Grant </a>
</li>
<li class="main">
<a href="namespace-Baguette.Mastodon.Service.html">
Service </a>
</li>
</ul></li></ul></li>
<li>
<a href="namespace-GuzzleHttp.html">
GuzzleHttp<span></span>
</a>
<ul>
<li>
<a href="namespace-GuzzleHttp.Cookie.html">
Cookie </a>
</li>
<li>
<a href="namespace-GuzzleHttp.Exception.html">
Exception </a>
</li>
<li>
<a href="namespace-GuzzleHttp.Handler.html">
Handler </a>
</li>
<li>
<a href="namespace-GuzzleHttp.Promise.html">
Promise </a>
</li>
</ul></li>
<li class="active">
<a href="namespace-Psr.html">
Psr<span></span>
</a>
<ul>
<li class="active">
<a href="namespace-Psr.Http.html">
Http<span></span>
</a>
<ul>
<li class="active">
<a href="namespace-Psr.Http.Message.html">
Message </a>
</li>
</ul></li></ul></li>
<li>
<a href="namespace-Teto.html">
Teto<span></span>
</a>
<ul>
<li>
<a href="namespace-Teto.Object.html">
Object </a>
</li>
</ul></li>
</ul>
</div>
<hr>
<div id="elements">
<h3>Interfaces</h3>
<ul>
<li><a href="class-Psr.Http.Message.MessageInterface.html">MessageInterface</a></li>
<li><a href="class-Psr.Http.Message.RequestInterface.html">RequestInterface</a></li>
<li><a href="class-Psr.Http.Message.ResponseInterface.html">ResponseInterface</a></li>
<li><a href="class-Psr.Http.Message.ServerRequestInterface.html">ServerRequestInterface</a></li>
<li><a href="class-Psr.Http.Message.StreamInterface.html">StreamInterface</a></li>
<li class="active"><a href="class-Psr.Http.Message.UploadedFileInterface.html">UploadedFileInterface</a></li>
<li><a href="class-Psr.Http.Message.UriInterface.html">UriInterface</a></li>
</ul>
</div>
</div>
</div>
<div id="splitter"></div>
<div id="right">
<div id="rightInner">
<form id="search">
<input type="hidden" name="cx" value="">
<input type="hidden" name="ie" value="UTF-8">
<input type="text" name="q" class="text" placeholder="Search">
</form>
<div id="navigation">
<ul>
<li>
<a href="index.html" title="Overview"><span>Overview</span></a>
</li>
<li>
<a href="namespace-Psr.Http.Message.html" title="Summary of Psr\Http\Message"><span>Namespace</span></a>
</li>
<li class="active">
<span>Class</span> </li>
</ul>
<ul>
</ul>
<ul>
</ul>
</div>
<div id="content" class="class">
<h1>Interface UploadedFileInterface</h1>
<div class="description">
<p>Value object representing a file uploaded through an HTTP request.</p>
<p>Instances of this interface are considered immutable; all methods that
might change state MUST be implemented such that they retain the internal
state of the current instance and return an instance that contains the
changed state.</p>
</div>
<div class="info">
<b>Namespace:</b> <a href="namespace-Psr.html">Psr</a>\<a href="namespace-Psr.Http.html">Http</a>\<a href="namespace-Psr.Http.Message.html">Message</a><br>
<b>Located at</b> <a href="source-class-Psr.Http.Message.UploadedFileInterface.html#5-123" title="Go to source code">UploadedFileInterface.php</a>
<br>
</div>
<table class="summary methods" id="methods">
<caption>Methods summary</caption>
<tr data-order="getStream" id="_getStream">
<td class="attributes"><code>
public
<code><a href="class-Psr.Http.Message.StreamInterface.html">Psr\Http\Message\StreamInterface</a></code>
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getStream">#</a>
<code><a href="source-class-Psr.Http.Message.UploadedFileInterface.html#15-31" title="Go to source code">getStream</a>( )</code>
<div class="description short">
<p>Retrieve a stream representing the uploaded file.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve a stream representing the uploaded file.</p>
<p>This method MUST return a StreamInterface instance, representing the
uploaded file. The purpose of this method is to allow utilizing native PHP
stream functionality to manipulate the file upload, such as
stream_copy_to_stream() (though the result will need to be decorated in a
native PHP stream wrapper to work with such functions).</p>
<p>If the moveTo() method has been called previously, this method MUST raise
an exception.</p>
<h4>Returns</h4>
<div class="list">
<code><a href="class-Psr.Http.Message.StreamInterface.html">Psr\Http\Message\StreamInterface</a></code><br>Stream representation of the uploaded file.
</div>
<h4>Throws</h4>
<div class="list">
RuntimeException<br><p>in cases when no stream is available or can be
created.</p>
</div>
</div>
</div></td>
</tr>
<tr data-order="moveTo" id="_moveTo">
<td class="attributes"><code>
public
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_moveTo">#</a>
<code><a href="source-class-Psr.Http.Message.UploadedFileInterface.html#33-65" title="Go to source code">moveTo</a>( <span>string <var>$targetPath</var></span> )</code>
<div class="description short">
<p>Move the uploaded file to a new location.</p>
</div>
<div class="description detailed hidden">
<p>Move the uploaded file to a new location.</p>
<p>Use this method as an alternative to move_uploaded_file(). This method is
guaranteed to work in both SAPI and non-SAPI environments.
Implementations must determine which environment they are in, and use the
appropriate method (move_uploaded_file(), rename(), or a stream
operation) to perform the operation.</p>
<p>$targetPath may be an absolute path, or a relative path. If it is a
relative path, resolution should be the same as used by PHP's rename()
function.</p>
<p>The original file or stream MUST be removed on completion.</p>
<p>If this method is called more than once, any subsequent calls MUST raise
an exception.</p>
<p>When used in an SAPI environment where $_FILES is populated, when writing
files via moveTo(), is_uploaded_file() and move_uploaded_file() SHOULD be
used to ensure permissions and upload status are verified correctly.</p>
<p>If you wish to move to a stream, use getStream(), as SAPI operations
cannot guarantee writing to stream destinations.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$targetPath</var></dt>
<dd>Path to which to move the uploaded file.</dd>
</dl></div>
<h4>Throws</h4>
<div class="list">
InvalidArgumentException<br>if the $targetPath specified is invalid.<br>
RuntimeException<br><p>on any error during the move operation, or on
the second or subsequent call to the method.</p>
</div>
<h4>See</h4>
<div class="list">
http://php.net/is_uploaded_file<br>
http://php.net/move_uploaded_file<br>
</div>
</div>
</div></td>
</tr>
<tr data-order="getSize" id="_getSize">
<td class="attributes"><code>
public
integer|null
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getSize">#</a>
<code><a href="source-class-Psr.Http.Message.UploadedFileInterface.html#67-76" title="Go to source code">getSize</a>( )</code>
<div class="description short">
<p>Retrieve the file size.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve the file size.</p>
<p>Implementations SHOULD return the value stored in the "size" key of
the file in the $_FILES array if available, as PHP calculates this based
on the actual size transmitted.</p>
<h4>Returns</h4>
<div class="list">
integer|null<br>The file size in bytes or null if unknown.
</div>
</div>
</div></td>
</tr>
<tr data-order="getError" id="_getError">
<td class="attributes"><code>
public
integer
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getError">#</a>
<code><a href="source-class-Psr.Http.Message.UploadedFileInterface.html#78-92" title="Go to source code">getError</a>( )</code>
<div class="description short">
<p>Retrieve the error associated with the uploaded file.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve the error associated with the uploaded file.</p>
<p>The return value MUST be one of PHP's UPLOAD_ERR_XXX constants.</p>
<p>If the file was uploaded successfully, this method MUST return
UPLOAD_ERR_OK.</p>
<p>Implementations SHOULD return the value stored in the "error" key of
the file in the $_FILES array.</p>
<h4>Returns</h4>
<div class="list">
integer<br>One of PHP's UPLOAD_ERR_XXX constants.
</div>
<h4>See</h4>
<div class="list">
http://php.net/manual/en/features.file-upload.errors.php<br>
</div>
</div>
</div></td>
</tr>
<tr data-order="getClientFilename" id="_getClientFilename">
<td class="attributes"><code>
public
string|null
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getClientFilename">#</a>
<code><a href="source-class-Psr.Http.Message.UploadedFileInterface.html#94-107" title="Go to source code">getClientFilename</a>( )</code>
<div class="description short">
<p>Retrieve the filename sent by the client.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve the filename sent by the client.</p>
<p>Do not trust the value returned by this method. A client could send
a malicious filename with the intention to corrupt or hack your
application.</p>
<p>Implementations SHOULD return the value stored in the "name" key of
the file in the $_FILES array.</p>
<h4>Returns</h4>
<div class="list">
string|null<br><p>The filename sent by the client or null if none
was provided.</p>
</div>
</div>
</div></td>
</tr>
<tr data-order="getClientMediaType" id="_getClientMediaType">
<td class="attributes"><code>
public
string|null
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getClientMediaType">#</a>
<code><a href="source-class-Psr.Http.Message.UploadedFileInterface.html#109-122" title="Go to source code">getClientMediaType</a>( )</code>
<div class="description short">
<p>Retrieve the media type sent by the client.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve the media type sent by the client.</p>
<p>Do not trust the value returned by this method. A client could send
a malicious media type with the intention to corrupt or hack your
application.</p>
<p>Implementations SHOULD return the value stored in the "type" key of
the file in the $_FILES array.</p>
<h4>Returns</h4>
<div class="list">
string|null<br><p>The media type sent by the client or null if none
was provided.</p>
</div>
</div>
</div></td>
</tr>
</table>
</div>
<div id="footer">
ξ ^ω^)ξ Baguette PHP Mastodon API Client / SDK API documentation generated by <a href="http://apigen.org">ApiGen</a>
</div>
</div>
</div>
<script src="resources/combined.js"></script>
<script src="elementlist.js"></script>
</body>
</html>