Beispiel #1
0
 /**
  * Accepts the information of the uploaded file as provided by the PHP
  * global $_FILES.
  *
  * @param string  $tmpName  The full temporary path to the file
  * @param string  $name     The original file name
  * @param string  $type     The type of the file as provided by PHP
  * @param integer $size     The file size
  * @param string  $error    The error constant of the upload. Should be
  *                          one of PHP's UPLOAD_XXX constants.
  */
 public function __construct($path, $originalName, $mimeType, $size, $error)
 {
     if (!ini_get('file_uploads')) {
         throw new FileException(sprintf('Unable to create UploadedFile because "file_uploads" is disabled in your php.ini file (%s)', get_cfg_var('cfg_file_path')));
     }
     parent::__construct($path);
     if (is_null($error)) {
         $error = UPLOAD_ERR_OK;
     }
     if (is_null($mimeType)) {
         $mimeType = 'application/octet-stream';
     }
     $this->originalName = (string) $originalName;
     $this->mimeType = $mimeType;
     $this->size = $size;
     $this->error = $error;
 }