|
30 | 30 | */ |
31 | 31 | class UploadController extends BaseController |
32 | 32 | { |
33 | | - #[OA\Post( |
34 | | - path: '/api/v1/files/upload', |
35 | | - summary: 'Upload file with chunked support', |
36 | | - description: 'Handles file uploads with support for chunked uploads. Returns file metadata on completion or upload progress for chunks.', |
37 | | - security: [['bearer' => []]], |
38 | | - tags: ['files'], |
39 | | - requestBody: new OA\RequestBody( |
40 | | - required: true, |
41 | | - content: new OA\MediaType( |
42 | | - mediaType: 'multipart/form-data', |
43 | | - schema: new OA\Schema( |
44 | | - required: ['file'], |
45 | | - properties: [ |
46 | | - new OA\Property( |
47 | | - property: 'file', |
48 | | - type: 'string', |
49 | | - format: 'binary', |
50 | | - description: 'File to upload' |
51 | | - ), |
52 | | - ] |
53 | | - ) |
54 | | - ) |
55 | | - ), |
56 | | - responses: [ |
57 | | - new OA\Response( |
58 | | - response: Response::HTTP_OK, |
59 | | - description: 'File uploaded successfully or chunk progress', |
60 | | - content: new OA\JsonContent( |
61 | | - oneOf: [ |
62 | | - new OA\Schema(ref: '#/components/schemas/FileUploadCompleteResponse'), |
63 | | - new OA\Schema(ref: '#/components/schemas/FileUploadProgressResponse'), |
64 | | - ] |
65 | | - ) |
66 | | - ), |
67 | | - new OA\Response(response: Response::HTTP_BAD_REQUEST, description: 'Bad Request'), |
68 | | - new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: 'Unauthorized'), |
69 | | - new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: 'Server Error'), |
70 | | - ] |
71 | | - )] |
72 | 33 | public function upload(Request $request) { |
73 | 34 | // create the file receiver |
74 | 35 | $receiver = new FileReceiver("file", $request, HandlerFactory::classFromRequest($request)); |
|
0 commit comments