code: private Handler<Message<Buffer>> handleUpload(final AsyncFile file, final String address) {
      final AtomicLong position = new AtomicLong();
      return new Handler<Message<Buffer>>() {
        @Override
        public void handle(final Message<Buffer> message) {
          final Handler<Message<Buffer>> handler = this;
          final Buffer buffer = message.body();
          if (buffer.length() > 0) {
            file.write(buffer, position.get(), new Handler<AsyncResult<Void>>() {
              @Override
              public void handle(AsyncResult<Void> result) {
                if (result.failed()) {
                  file.close();
                  message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
                  vertx.eventBus().unregisterHandler(address, handler);
                } else {
                  position.addAndGet(buffer.length());
                  message.reply(new JsonObject().putString("status", "ok"));
                }
              }
            });
          } else {
            file.flush(new Handler<AsyncResult<Void>>() {
              @Override
              public void handle(AsyncResult<Void> result) {
                if (result.failed()) {
                  message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
                  vertx.eventBus().unregisterHandler(address, handler);
                } else {
                  file.close(new Handler<AsyncResult<Void>>() {
                    @Override
                    public void handle(AsyncResult<Void> result) {
                      if (result.failed()) {
                        message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
                        vertx.eventBus().unregisterHandler(address, handler);
                      } else {
                        vertx.eventBus().unregisterHandler(address, handler, new Handler<AsyncResult<Void>>() {
                          @Override
                          public void handle(AsyncResult<Void> result) {
                            message.reply(new JsonObject().putString("status", "ok"));
                          }
                        });
                      }
                    }
                  });
                }
              }
            });
          }
        }
      };
    }
docs: Handles a file upload.