1. /**
    2. * Created by PhpStorm.
    3. * User: yf
    4. * Date: 2018/5/24
    5. * Time: 下午3:20
    6. */
    7. namespace EasySwoole\Http\Message;
    8. class UploadFile
    9. {
    10. private $tempName;
    11. private $stream;
    12. private $size;
    13. private $error;
    14. private $clientFileName;
    15. private $clientMediaType;
    16. function __construct( $tempName,$size, $errorStatus, $clientFilename = null, $clientMediaType = null)
    17. {
    18. $this->tempName = $tempName;
    19. $this->size = $size;
    20. $this->clientFileName = $clientFilename;
    21. $this->clientMediaType = $clientMediaType;
    22. }
    23. public function getTempName() {
    24. // TODO: Implement getTempName() method.
    25. return $this->tempName;
    26. }
    27. public function getStream()
    28. {
    29. // TODO: Implement getStream() method.
    30. return $this->stream;
    31. }
    32. public function moveTo($targetPath)
    33. {
    34. // TODO: Implement moveTo() method.
    35. return file_put_contents($targetPath,$this->stream) ? true :false;
    36. }
    37. {
    38. // TODO: Implement getSize() method.
    39. return $this->size;
    40. }
    41. public function getError()
    42. {
    43. // TODO: Implement getError() method.
    44. return $this->error;
    45. }
    46. public function getClientFilename()
    47. {
    48. // TODO: Implement getClientFilename() method.
    49. return $this->clientFileName;
    50. }
    51. public function getClientMediaType()
    52. {
    53. // TODO: Implement getClientMediaType() method.
    54. return $this->clientMediaType;
    55. }