| @@ 50-64 (lines=15) @@ | ||
| 47 | * |
|
| 48 | * @return ResponseInterface |
|
| 49 | */ |
|
| 50 | public function upload(string $file) : ResponseInterface |
|
| 51 | { |
|
| 52 | if (false === file_exists($file)) |
|
| 53 | { |
|
| 54 | throw new \UnexpectedValueException('File not found for upload'); |
|
| 55 | } |
|
| 56 | ||
| 57 | $data = [[ |
|
| 58 | 'name' => 'file', |
|
| 59 | 'contents' => fopen($file, 'r') |
|
| 60 | ]]; |
|
| 61 | ||
| 62 | return $this->getHttpClient() |
|
| 63 | ->post($this->getBasePath('upload-glossary'), ['multipart' => $data]); |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||
| @@ 63-77 (lines=15) @@ | ||
| 60 | * |
|
| 61 | * @return ResponseInterface |
|
| 62 | */ |
|
| 63 | public function upload(string $file) : ResponseInterface |
|
| 64 | { |
|
| 65 | if (false === file_exists($file)) |
|
| 66 | { |
|
| 67 | throw new \UnexpectedValueException('File not found for upload'); |
|
| 68 | } |
|
| 69 | ||
| 70 | $data = [[ |
|
| 71 | 'name' => 'file', |
|
| 72 | 'contents' => fopen($file, 'r') |
|
| 73 | ]]; |
|
| 74 | ||
| 75 | return $this->getHttpClient() |
|
| 76 | ->post($this->getBasePath('upload-tm'), ['multipart' => $data]); |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||