code: public URL uploadFile(File file, UploadProgressListener listener) throws InterruptedException,
              XMPPException.XMPPErrorException, SmackException, IOException {
          if (!file.isFile()) {
              throw new FileNotFoundException("The path " + file.getAbsolutePath() + " is not a file");
          }
          final Slot slot = requestSlot(file.getName(), file.length(), "application/octet-stream");
  
          uploadFile(file, slot, listener);
  
          return slot.getGetUrl();
      }
docs: Request slot and uploaded file to HTTP file upload service with progress callback.
  
  You don't need to request slot and upload file separately, this method will do both.
  Note that this is a synchronous call -- Smack must wait for the server response.
  
  @param file file to be uploaded
  @param listener upload progress listener of null
  @return public URL for sharing uploaded file
  
  @throws InterruptedException
  @throws XMPPException.XMPPErrorException
  @throws SmackException
  @throws IOException