0

I am working on a project where the user will upload a file to some endpoint. When the user uplaods the file my controller will parse the contents of this file and do some processing etc.

Something like this would happen

1.) User uploads a file to an endpoint.

2.) My controller gets informed about this

3.) Appropriate service reads the file

Now I know how spring controllers work but in this case instead of the json I need to have a file. So my controller will not receive a json. Instead it will receive a file which I will process.

I am not sure what the correct way to solve this problem is? I tried searching about this but am not finding suitable results. If some one can give some hints which can push me in the right direction, it would be very helpful.

varunkr
  • 5,364
  • 11
  • 50
  • 99
  • How about you just upload file to some directory and save its path to db? – Boldbayar Jan 11 '17 at 08:10
  • http://stackoverflow.com/questions/5673260/downloading-a-file-from-spring-controllers – Essex Boy Jan 11 '17 at 08:26
  • @EssexBoy Thanks for the link. I have a doubt though. Going by the first answer, whenever the file is uploaded to the endpoint will the controller be automatically hit as happens with an http call? Sorry for the ignorance. – varunkr Jan 11 '17 at 08:45

0 Answers0