| @@ 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 | ||
| @@ 62-76 (lines=15) @@ | ||
| 59 | * |
|
| 60 | * @return ResponseInterface |
|
| 61 | */ |
|
| 62 | public function upload(string $file) : ResponseInterface |
|
| 63 | { |
|
| 64 | if (false === file_exists($file)) |
|
| 65 | { |
|
| 66 | throw new \UnexpectedValueException('File not found for upload'); |
|
| 67 | } |
|
| 68 | ||
| 69 | $data = [[ |
|
| 70 | 'name' => 'file', |
|
| 71 | 'contents' => fopen($file, 'r') |
|
| 72 | ]]; |
|
| 73 | ||
| 74 | return $this->getHttpClient() |
|
| 75 | ->post($this->getBasePath('upload-tm'), ['multipart' => $data]); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||