Conditions | 2 |
Paths | 5 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function uploadAction($fileCollectionName = null) |
||
20 | { |
||
21 | try { |
||
22 | $this->checkCredentials(); |
||
23 | |||
24 | /** @var $fileCollection FileCollection */ |
||
25 | $fileCollection = $this->get('file_collection_manager')->getOrCreate($fileCollectionName); |
||
26 | |||
27 | $newFiles = $this->get('upload_manager')->upload( |
||
28 | $fileCollection |
||
29 | ); |
||
30 | |||
31 | return new JsonResponse(array( |
||
32 | 'status' => 'ok', |
||
33 | 'collection_name' => $fileCollection->getName(), |
||
34 | 'files' => $newFiles |
||
35 | )); |
||
36 | } catch(\Exception $e) { |
||
37 | return new JsonResponse(array( |
||
38 | 'status' => 'error', |
||
39 | 'message' => $e->getMessage() |
||
40 | )); |
||
41 | } |
||
42 | } |
||
43 | |||
45 |