Location: PHPKode > scripts > D3Upload > d3upload/D3Upload.class.php

/* D3Upload File Upload Class v1.0 [13.10.2009] */

# First version of class has many options to upload. Permitted file extensions, upload dir,  file size and file type variables are added. 
# D3Upload is Construct Function. 
# Value from form must be  $dosya=new D3Upload('Value'); 
# Error codes has been added in switch 
# Error Description is a different function.
# Files name will be changed as time() format name, number and unique  
  class D3Upload{
      var $inputName;       // <input name value
      var $fileName;        // original file name
      var $tmpName;        // fine name in tmp folder
      var $type;          // file type
      var $size;           // File Size as GB TB MB
      var $sizeAsKb;       // File Size as KB
      var $error;          // Error if exist
      var $uzanti;        // File Extensions
      var $izinliler=Array(); // Permitted file extensions
      var $sonuc;     // Result
      function D3Upload($inputName){   
           // Filling class variables.

      function upload($dir,$dosya_adi=False,$unique=False){       // is main upload function
          $this->error=in_array($this->uzanti,$this->izinliler) ? 0 : 99;
          $this->error=is_dir($dir)? $this->error : 98;     
          $this->error=is_writable($dir) ? $this->error : 97;
              case 0:
             $dosya_son_adi=$unique ? time().'.'.$this->uzanti : ($dosya_adi ? $dosya_adi.'.'.$this->uzanti : $this->fileName);
                     return $this;  
                 }else {
                    return $this;
                 return $this;
              case 4:
                return $this->hata('Dosya Seçmediniz. Hata Kodu: '.$this->error);   // Error: No file selected
                case 99:
                return $this->hata($this->uzanti.' İzin verilen bir dosya tipi değilr Hata Kodu : '.$this->error);
                case 98:
                return $this->hata($dir.' Geçerli Bir Klasör Değil');       // Error: is not a folder
                case 97:
                  return $this->hata($dir.' Yazılabilir Değil.!');          // Error: folder is not writable
                return $this->hata('Bilinmeyen Hata Kodu : '.$this->error);        // Error: Unknown Error ( General Error )
      function izinli($uzantilar){
           return $this;

      function hata($aciklama){

Return current item: D3Upload