title: How to know video is successfully uploaded or not?
body: <p>I have a method which takes a file and upload it on given path.</p>
  
  <p>Here is my service</p>
  
  <pre><code>public String fileUpload(MultipartFile file) throws IOException {
          log.debug("uploading video");
          File fileUpload = new File(file.getOriginalFilename());
          if (!file.isEmpty()) {
  
              InputStream inputStream = file.getInputStream();
              byte[] buf = new byte[1024];
              FileOutputStream fileOutputStream = new FileOutputStream(new File(
                      fileUploadPath + File.separator
                              + file.getOriginalFilename()));
              int numRead = 0;
              while ((numRead = inputStream.read(buf)) &gt;= 0) {
                  fileOutputStream.write(buf, 0, numRead);
              }
              inputStream.close();
              fileOutputStream.close();
  }
  else {
              return Constants.EMPTY_FILE;
          }
  }
  </code></pre>
  
  <p>After uploading the file i have to save it information in my database.File size could be 1GB or 2GB.My problem is how would i know the file is fully uploaded or not.So that i can save it status uploaded successfully in my db.
  Anyone please help me looking into this ? </p>