<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filesystem.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.copy.php',
    1 => 'copy',
    2 => 'Copia un file',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'Filesystem Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.clearstatcache.php',
    1 => 'clearstatcache',
  ),
  'next' => 
  array (
    0 => 'function.delete.php',
    1 => 'delete',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/filesystem/functions/copy.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.copy" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">copy</h1>
    <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">copy</span> &mdash; <span class="dc-title">Copia un file</span></p>

   </div>
   <div class="refsect1 unknown-535" id="refsect1-function.copy-unknown-535">
    <h3 class="title">Descrizione</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>copy</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$source</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$dest</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

    <p class="para rdfs-comment">
     Copia il file <code class="parameter">source</code> in
     <code class="parameter">dest</code>. Restituisce <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> in caso di successo, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento.
     <div class="example" id="example-1">
      <p><strong>Example #1 <span class="function"><strong>copy()</strong></span> example</strong></p>
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$file </span><span style="color: #007700">= </span><span style="color: #DD0000">'example.txt'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$newfile </span><span style="color: #007700">= </span><span style="color: #DD0000">'example.txt.bak'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$file </span><span style="color: #007700">= </span><span style="color: #DD0000">'example.txt'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$newfile </span><span style="color: #007700">= </span><span style="color: #DD0000">'example.txt.bak'</span><span style="color: #007700">;<br /><br />    if (!</span><span style="color: #0000BB">copy</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">, </span><span style="color: #0000BB">$newfile</span><span style="color: #007700">)) {<br />    echo </span><span style="color: #DD0000">"Copia di </span><span style="color: #0000BB">$file</span><span style="color: #DD0000"> non riuscita ...\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

     </div>
    </p>
    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <p class="para">
      Come da PHP 4.3.0, sia <code class="parameter">source</code> che
      <code class="parameter">dest</code> potrebbero essere URL se &quot;fopen wrappers&quot;
      è stato abilitato. Vedere <span class="function"><a href="function.fopen.php" class="function">fopen()</a></span> per ulteriori dettagli.
      Se il parametro <code class="parameter">dest</code> punta ad un URL, l&#039;operazione di copia
      potrebbe fallire se il wrapper non supporta la sovrascrittura di file esistenti.
     </p>
    </p></blockquote>
    <div class="warning"><strong class="warning">Avviso</strong>
     <p class="para">
      Se il file di destinazione già esiste, esso verrà sovrascritto.
     </p>
    </div>
    <blockquote class="note"><p><strong class="note">Nota</strong>:  
       <p class="para"> 
        Nota di compatibilità con Windows: se viene copiato un file vuoto, 
        <span class="function"><strong>copy()</strong></span> restituisce falso, ma il file sarà copiato 
        correttamente. 
       </p> 
      </p></blockquote> 
      <p class="para">
     Vedere anche <span class="function"><a href="function.move-uploaded-file.php" class="function">move_uploaded_file()</a></span>,
     <span class="function"><a href="function.rename.php" class="function">rename()</a></span>, e la sezione del manuale
     riguardo <a href="features.file-upload.php" class="link">handling file
     uploads</a>.
    </p>
   </div>

  </div><?php manual_footer($setup); ?>