Advertisement
SashaRaaa

Untitled

Jul 20th, 2018
969
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class Uploader {
  4.  
  5. public $field;
  6. public $file;
  7.  
  8. public function __construct ($field) {
  9.     $this->field = $field;
  10. }
  11.  
  12. public function isUploaded() {
  13.  
  14. return isset($_FILES [$this->field]) && (0 == $_FILES [$this->field]['error']);
  15.      }
  16.      
  17. public function upload() {
  18.     if ( $this->isUploaded() ) {
  19.     move_uploaded_file(
  20.     $_FILES [$this->field]['tmp_name'],
  21.     __DIR__ . '/images/uploaded.jpeg'
  22.     );
  23.    
  24.     }
  25. }
  26.  
  27. }
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement