Updated Controller

Added the upload functionality and according saving in database