title: Php oop file upload
body: <p>I work on a oop php file upload script. Is simple. But doesnt work. What is the problem? I learn how to use $_FILE, and how to code oop style.</p>
  
  <p>Thanks.</p>
  
  <p>upload.php are :</p>
  
  <pre><code>&lt;?php
  class upload{
      public $src = "./upload/";
      public $tmp;
      public $filename;
      public $type;
      public $uploadfile;
  
      public function startupload(){
          $this -&gt; filename = $_FILES["file"]["name"];
          $this -&gt; tmp = $_FILES["file"]["tmp_name"];
          $this -&gt; uploadfile = $src . basename($this -&gt; name);
      }
      public function uploadfile(){
          if(move_uploaded_file($this -&gt; tmp, $this -&gt; uploadFile)){
              return true;
          }
      }
  
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>index.php are:</p>
  
  <pre><code>&lt;?php 
  require_once('./lib/upload.php');
  ?&gt;
  
  &lt;?php
  if(isset($_POST['file'])){
      $fileupload = new upload();
      if($fileupload -&gt; uploadfile()){
          echo 'Fisierul a fost uploadat';
      }
  }
  ?&gt;
  
  &lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;form align="center" enctype="multipart/form-data" action="&lt;?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?&gt;" method="post"&gt;
  Select upload file: &lt;input type="file" name="file" required="yes"  /&gt;
  &lt;input type="submit" value="Trimite" /&gt;
  &lt;p&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Where i'm wrong with my tinking?</p>