Conditions | 4 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function save(Http\FileUpload $fileUpload, $path = '', $destinationAlias = NULL) |
||
27 | { |
||
28 | if (!$fileUpload->isOk()) { |
||
29 | throw new FileUploadFaildException($fileUpload->getName(), $fileUpload->getError()); |
||
30 | } elseif ($path) { |
||
31 | $path = trim($path, '\/') . DIRECTORY_SEPARATOR; |
||
32 | } |
||
33 | |||
34 | do { |
||
35 | $relativePath = $path . $this->createName($fileUpload); |
||
36 | $pathname = $this->documentRoot->createAbsolutePath($relativePath, $destinationAlias); |
||
37 | } while (is_file($pathname)); |
||
38 | |||
39 | $fileUpload->move($pathname); |
||
40 | return $relativePath; |
||
41 | } |
||
42 | |||
55 |