private File writeToFile(final InputStream uploadedInputStream,final String fileName){
  final File file=new File(fileName);
  try {
    final OutputStream out=new FileOutputStream(new File(fileName));
    int read=0;
    final byte[] bytes=new byte[1024];
    while ((read=uploadedInputStream.read(bytes)) != -1)     out.write(bytes,0,read);
    out.flush();
    out.close();
  }
 catch (  final IOException e) {
  }
  return file;
}

private File writeToFile ( final InputStream uploadedInputStream , final String fileName ) { final File file = new File ( fileName ) ; try { final OutputStream out = new FileOutputStream ( new File ( fileName ) ) ; int read = 0 ; final byte [ ] bytes = new byte [ 1024 ] ; while ( ( read = uploadedInputStream . read ( bytes ) ) != - 1 ) out . write ( bytes , 0 , read ) ; out . flush ( ) ; out . close ( ) ; } catch ( final IOException e ) { } return file ; }
this method is used to convert incoming inputstream object to file object
