title: How to convert MultipartFile into byte stream
body: <p>//Or any other solution to saving multipartfile into DB.
  I tried with this way but getting error.</p>
  
  <pre><code>File fileOne = new File("file.getOrignalFileName");//what should be kept inside this method 
  byte[] bFile = new byte[(int) fileOne.length()];
  try {
      FileInputStream fileInputStream = new FileInputStream(fileOne);
      //convert file into array of bytes
      fileInputStream.read(bFile);
      fileInputStream.close();
  } catch (Exception e) {
      e.printStackTrace();
  }
  questionDao.saveImage(bFile);
  </code></pre>