Skip to content

Instantly share code, notes, and snippets.

@fatihkurcenli
Last active February 7, 2022 12:10
Show Gist options
  • Save fatihkurcenli/135dbf029e53d7aed499e888752787c7 to your computer and use it in GitHub Desktop.
Save fatihkurcenli/135dbf029e53d7aed499e888752787c7 to your computer and use it in GitHub Desktop.
VideoController
@RestController
@RequestMapping("/api/v1/videos")
class VideoController {
@Autowired
private lateinit var fileUploadService: FileUploadService
@PostMapping()
@ResponseStatus(HttpStatus.OK)
fun uploadVideo(@RequestParam("file") file: MultipartFile): SuccessErrorModel {
val success = fileUploadService.uploadFileLocal(file)
val model = SuccessErrorModel()
if (success) {
model.success = "Success"
} else {
model.error = "Failed"
}
return model
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment