title: FTP upload via PHP form
body: <p>I want to upload a file via FTP upload in a form. </p>
  
  <pre><code>&lt;html&gt;
    &lt;body&gt;
      &lt;form enctype="multipart/form-data" action="upload_file.php" method="POST"&gt;
        &lt;input type="hidden" name="MAX_FILE_SIZE" value="100000" /&gt;
        Choose a file to upload: &lt;input name="uploadedfile" type="file" /&gt;&lt;br /&gt;
        &lt;input type="submit" value="Upload File" /&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the PHP file: </p>
  
  <pre><code>&lt;?php
  
  $ftp_server = "xxx";
  $ftp_username   = "xxx";
  $ftp_password   =  "xxx";
  
  // setup of connection
  $conn_id = ftp_connect($ftp_server) or die("could not connect to $ftp_server");
  
  // login
  if (@ftp_login($conn_id, $ftp_username, $ftp_password))
  {
    echo "conectd as $ftp_username@$ftp_server\n";
  }
  else
  {
    echo "could not connect as $ftp_username\n";
  }
  
  $file = $_FILES["file"]["name"];
  $remote_file_path = "/home/www/lifestyle69/import/".$file;
  ftp_put($conn_id, $remote_file_path, $file, FTP_ASCII);
  ftp_close($conn_id);
  echo "\n\nconnection closed";
  
  ?&gt;
  </code></pre>
  
  <p>The FTP connection connects successfully but the file is nowhere.</p>
  
  <p>Can anybody help me?</p>
  
  <p>Thanks!</p>