title: Java file upload - inputstream issue
body: <p>I have to upload some files from jsp page, when i read the inputstream for the same.
  I am checking for its authenticity that its a valid file or not, for that I am using <a href="http://1.%09http://sourceforge.net/projects/jmimemagic/"><code>jmimemagic</code> </a> and it takes input stream as argument and now when I am trying to upload it, its only uploading 1 byte of data?</p>
  
  <p>I feel like there is some issue with inputstream any solution pls?</p>
  
  <pre><code> //For checking the file type
  InputStream loIns = aoFileStream.getInputStreamToReadFile();
              byte[] fileArray = IOUtils.toByteArray(loIns);
              mimeType = Magic.getMagicMatch(fileArray, true).getMimeType();
              if(!loAllowedFileTypesMimeList.contains(mimeType)){
                  return false;
              }else{
                  String lsFileName = aoFileStream.getFileName();
                  String lsFileExt = lsFileName.substring(lsFileName.lastIndexOf(".") + 1);
                  if(loAllowedFileTypesList.contains(lsFileExt.toLowerCase())){
                      return true;
                  }
                  return false;
              } 
  
  
  
  // For uploading the content
  File loOutputFile = new File(asFilePathToUpload);
              if(!loOutputFile.exists()){
                  FileOutputStream loOutput = new FileOutputStream(loOutputFile);
                  while (liEnd != -1) {
                      liEnd = inputStreamToReadFile.read();
                      loOutput.write(liEnd);
                  }
                  inputStreamToReadFile.close();
                  loOutput.close();
              }
  </code></pre>