Skip to content

Instantly share code, notes, and snippets.

@mohashari
Created March 16, 2018 00:11
Show Gist options
  • Select an option

  • Save mohashari/1cd665cd9c9052a0e72945590b6be4e0 to your computer and use it in GitHub Desktop.

Select an option

Save mohashari/1cd665cd9c9052a0e72945590b6be4e0 to your computer and use it in GitHub Desktop.
@RestController
@RequestMapping("/api/v1/storage")
public class AmazonS3Controller {
private AmazonS3Service amazonS3Service;
@Autowired
AmazonS3Controller(AmazonS3Service amazonS3Service){
this.amazonS3Service = amazonS3Service;
}
@PostMapping("/uploadFile")
public String uploadFile(@RequestPart(value = "file") MultipartFile file) {
return this.amazonS3Service.uploadFile(file);
}
@DeleteMapping("/deleteFile")
public String deleteFile(@RequestPart(value = "url") String fileUrl) {
return this.amazonS3Service.deleteFileFromS3Bucket(fileUrl);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment