| Conditions | 4 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 35 | public function save(Http\FileUpload $fileUpload, $destination = '') |
||
| 36 | { |
||
| 37 | if (!$fileUpload->isOk()) { |
||
| 38 | throw new FileUploadFaildException($fileUpload->getName(), $fileUpload->getError()); |
||
| 39 | } elseif ($destination) { |
||
| 40 | $destination = trim($destination, '\/') . DIRECTORY_SEPARATOR; |
||
| 41 | } |
||
| 42 | |||
| 43 | do { |
||
| 44 | $relativePath = $destination . $this->createName($fileUpload); |
||
| 45 | $pathname = $this->documentRoot->createAbsolutePath($relativePath); |
||
| 46 | } while (is_file($pathname)); |
||
| 47 | |||
| 48 | $fileUpload->move($pathname); |
||
| 49 | return $relativePath; |
||
| 50 | } |
||
| 51 | |||
| 64 |