This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
Sequenzia/lib/Rails/ActionDispatch/Http/UploadedFile.php

59 lines
1.0 KiB
PHP
Raw Normal View History

2013-10-02 18:14:53 +02:00
<?php
namespace Rails\ActionDispatch\Http;
class UploadedFile
{
protected $name;
protected $type;
protected $tempName;
protected $error;
protected $size;
public function __construct(array $data)
{
$this->name = $data['name'];
$this->type = $data['type'];
$this->tempName = $data['tmp_name'];
$this->error = $data['error'];
$this->size = $data['size'];
}
public function name()
{
return $this->name;
}
public function type()
{
return $this->type;
}
public function tempName()
{
return $this->tempName;
}
public function size()
{
return $this->size;
}
public function errorCode()
{
return $this->error;
}
public function error()
{
return !($this->error == UPLOAD_ERR_OK);
}
public function move($newName)
{
return move_uploaded_file($this->tempName, $newName);
}
}