[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/file/ -> fileupload.class.php (source)

   1  <?php
   2  
   3      /**
   4       * \ingroup File
   5       *
   6       * Object representation of a file upload.
   7       * Wraps around the values in the $_FILES or $HTTP_POST_FILES array.
   8       */
   9      class FileUpload  
  10      {
  11  
  12          var $_name;
  13          var $_mimeType;
  14          var $_tmpName;
  15          var $_error;
  16          var $_size;
  17          var $_folder;
  18  
  19          /**
  20           * Constructor. Takes as a parameter a position of the $_FILES array.
  21           *
  22           * @param uploadInfo An associative array with information about the file uploaded.
  23           */
  24          function FileUpload( $uploadInfo )
  25          {
  26              $this->_name     = $uploadInfo["name"];
  27              $this->_mimeType = $uploadInfo["type"];
  28              $this->_tmpName  = $uploadInfo["tmp_name"];
  29              $this->_size     = $uploadInfo["size"];
  30              $this->_error    = $uploadInfo["error"];
  31              $this->_folder   = null;
  32          }
  33  
  34          /**
  35           * returns the real name of the file uploaded
  36           *
  37           * @return the file name
  38           */
  39          function getFileName()
  40          {
  41              return $this->_name;
  42          }
  43  
  44  		function setFileName( $fileName ) 
  45          {
  46              $this->_name = $fileName;
  47          }
  48  
  49          /**
  50           * returns the MIME type of the file
  51           *
  52           * @return a MIME type
  53           */
  54          function getMimeType()
  55          {
  56              return $this->_mimeType;
  57          }
  58  
  59          /**
  60           * @return returns the name of this file in the temporary folder
  61           */
  62          function getTmpName()
  63          {
  64              return $this->_tmpName;
  65          }
  66  
  67          /**
  68           * @returns an error code if there was a problem uploading the file
  69           *
  70           * @see http://www.php.net/manual/en/features.file-upload.errors.php
  71           */
  72          function getError()
  73          {
  74              return $this->_error;
  75          }
  76  
  77          /**
  78           * sets the error code. This method will be rarely needed
  79           *
  80           * @param error A valid PHP upload error code
  81           * @see http://www.php.net/manual/en/features.file-upload.errors.php
  82           */
  83          function setError( $error )
  84          {
  85              $this->_error = $error;
  86          }
  87  
  88          /**
  89           * @return returns the size of the uploaded file
  90           */
  91          function getSize()
  92          {
  93              return $this->_size;
  94          }
  95  
  96          /**
  97           * sets the folder
  98           *
  99           * @param folder
 100           */
 101          function setFolder( $folder )
 102          {
 103              $this->_folder = $folder;
 104          }
 105  
 106          /**
 107           * @returns the folder
 108           */
 109          function getFolder()
 110          {
 111              return $this->_folder;
 112          }
 113      }
 114  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics