title: STFP Connection and Downloaded confusion
body: <p>Been trying to connect Filezilla and my website together via PHP and SFTP is proving to be tedious. </p>
  
  <p>How do you connect with STFP, the information online is very brief for the most part, I have downloaded the SSH2.php file and have used the code that is included in the file (the Test File) and it does not work. The page does not load, an error message is displayed due to the use of the SSH2 functions I suspect.</p>
  
  <p>Connection </p>
  
  <pre><code>// Connect to FileZilla
  include("../model/connection.php");
  $con = new SFTPobj();
  $connect =  $con-&gt;serverConnection();
  </code></pre>
  
  <p>Test File: </p>
  
  <pre><code>Class SFTPobj{
  function serverConnection()
  {
      include('../controller/SSH2.php');
      $server = "xx";
      $user = "xx";
      $pass = "xx";  
      $ssh = new Net_SSH2($server);
          if (!$ssh-&gt;login( $user, $pass)) {
          exit('Login Failed');
      }
      echo $ssh-&gt;exec('pwd');
      echo $ssh-&gt;exec('ls -la');
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Test File- * code (irrelavant for the most part): </p>
  
  <pre><code>    &lt;?php
      // Connect to database
      include("../model/connection.php");
      $con = new SFTPobj();
      $connect =  $con-&gt;serverConnection();
  
      if(isset($_POST['submit']))
          {
          $file = $_FILES['file'];
              print_r($file);
  
          $fileName=$_FILES['file']['name'];
          $fileTmpName=$_FILES['file']['tmp_name'];
          $fileSize=$_FILES['file']['size'];
          $fileError=$_FILES['file']['error'];
          $fileType=$_FILES['file']['type'];
  
          #only allow images
          $fileExt = explode('.', $fileName);
          $fileActualExt = strtolower(end($fileExt));
  
          #Image types
          $allowed = array('jpg','jpeg', 'png');
  
          #Check file type
          if(in_array($fileActualExt,$allowed))
          {
              if($fileError === 0)
              {
                  if($fileSize &lt; 500000) #500KB
                  {
                      $fileNameNew = uniqid('', true).".".$fileActualExt; #Random Number Generate
                      $fileDestination = '../view/pictures/week1'.$fileNameNew;
                      move_uploaded_file($fileTmpName,$fileDestination);
                      header("Location:../view/test.php?uploadSuccess");
                  }else{
                      echo "Your file is too big";
                  }
              }else{
                  echo "There was an error uploading your file";
              }
          }else{
              echo "You can not upload files of this type";
          }
  
  
  
      }
  
  ?&gt;
  </code></pre>