Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 10298

php-manual-en-7.2.11-1.mga7.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>Stores a file in the database</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongogridfs.get.html">MongoGridFS::get</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongogridfs.remove.html">MongoGridFS::remove</a></div>
 <div class="up"><a href="class.mongogridfs.html">MongoGridFS</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mongogridfs.put" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoGridFS::put</h1>
  <p class="verinfo">(PECL mongo &gt;=1.0.8)</p><p class="refpurpose"><span class="refname">MongoGridFS::put</span> &mdash; <span class="dc-title">Stores a file in the database</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongogridfs.put-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>MongoGridFS::put</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$metadata</code><span class="initializer"> = array()</span></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$options</code><span class="initializer"> = array()</span></span>
  ]] )</div>


  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    <span class="methodname"><strong>MongoGridFS::put()</strong></span> is an alias of <span class="methodname"><a href="mongogridfs.storefile.html" class="methodname">MongoGridFS::storeFile()</a></span>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongogridfs.put-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    
     <dt>

      <code class="parameter">filename</code>
     </dt>

     <dd>

      <p class="para">
       Name of the file to store.
      </p>
     </dd>

    
    
     <dt>

      <code class="parameter">metadata</code>
     </dt>

     <dd>

      <p class="para">
       Other metadata fields to include in the file document.
      </p>
      <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">These fields may also overwrite those that would be created automatically by the driver, as described in the MongoDB core documentation for the <a href="https://docs.mongodb.com/manual/core/gridfs/#the-files-collection" class="link external">&raquo;&nbsp;files collection</a>. Some practical use cases for this behavior would be to specify a custom <em>chunkSize</em> or <em>_id</em> for the file.</p></p></blockquote>
     </dd>

    
    
     <dt>

      <code class="parameter">options</code>
     </dt>

     <dd>

      <p class="para">
       An array of options for the insert operations executed against the
       <em>chunks</em> and <em>files</em> collections. See
       <span class="function"><a href="mongocollection.insert.html" class="function">MongoCollection::insert()</a></span> for documentation on these
       these options.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongogridfs.put-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">Returns the <em>_id</em> of the saved file document. This will be a generated <a href="class.mongoid.html" class="classname">MongoId</a> unless an <em>_id</em> was explicitly specified in the <code class="parameter">metadata</code> parameter.</p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongogridfs.put-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   Throws <a href="class.mongogridfsexception.html" class="classname">MongoGridFSException</a> if there is an error
   reading <code class="parameter">filename</code> or inserting into the
   <em>chunks</em> or <em>files</em> collections.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongogridfs.put-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="mongogridfs.storebytes.html" class="function" rel="rdfs-seeAlso">MongoGridFS::storeBytes()</a> - Stores a string of bytes in the database</span></li>
   <li class="member"><span class="function"><a href="mongogridfs.storefile.html" class="function" rel="rdfs-seeAlso">MongoGridFS::storeFile()</a> - Stores a file in the database</span></li>
   <li class="member"><span class="function"><a href="mongogridfs.storeupload.html" class="function" rel="rdfs-seeAlso">MongoGridFS::storeUpload()</a> - Stores an uploaded file in the database</span></li>
   <li class="member">MongoDB core docs on <a href="https://docs.mongodb.com/manual/core/gridfs/" class="link external">&raquo;&nbsp;GridFS</a></li>
  </ul>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongogridfs.get.html">MongoGridFS::get</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongogridfs.remove.html">MongoGridFS::remove</a></div>
 <div class="up"><a href="class.mongogridfs.html">MongoGridFS</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>