title: PHP - ftp_put + Copy Entire Folder Structure
body: <p>I'm trying to create an FTP script that will copy a local folder structure upto an FTP point. Basically to update a website.</p>
  
  <p>I have been testing the following code (have changed the user/pass/domain) but the connection doesn't fail and appears to be working.</p>
  
  <pre><code>   $server = 'ftp.domainname.co';
     $ftp_user_name = 'user';
     $ftp_user_pass = 'pass';
     $dest = '.';
     $source = '.';
     $mode = 'FTP_ASCII';
  
  
     $connection = ftp_connect($server);
  
     $login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);
  
     if (!$connection || !$login) { die('Connection attempt failed!'); }
  
     $upload = ftp_put($connection, $dest, $source, $mode);
  
     if (!$upload) { echo 'FTP upload failed!'; }
  
     ftp_close($connection); 
  </code></pre>
  
  <p>I'm confident the point that is breaking is the ftp_put line.
  My questions are:</p>
  
  <ol>
  <li><p>Can ftp_put upload an entire directory structure with files etc or is this just to upload one file at a time? Is there a different command I should be using?</p></li>
  <li><p>I think I have something wrong with these variables:</p>
  
  <pre><code>    $dest = '.';
      $source = '.';
      $mode = 'FTP_ASCII';
  </code></pre></li>
  </ol>
  
  <p>I believe mode is correct.</p>
  
  <p>$dest - this is just the root of the ftp server being ftp.domainname.co - should I put the ftp server name or what goes here.</p>
  
  <p>$source - this is a the current local path - I've also tried the full C:\etc path.</p>
  
  <p>I get this error:
  Warning: ftp_put() expects parameter 4 to be long</p>
  
  <p>any help would be great.</p>
  
  <p>thx</p>