'How to POST ImageView to server with Fast Android Networking?

I am trying to post an image to a server with Fast Android Networking and I can't figure out how. The image gets uploaded from an emulator in Android Studio and put in an ImageView, how can I send that image to the server with a POST request?

The code under my starting point and is mostly from https://amitshekhar.me/Fast-Android-Networking/post_request.html if that helps.

AndroidNetworking.post("https://fierce-cove-29863.herokuapp.com/postFile")
                .setContentType(file) // posting any type of file
                .setTag("test")
                .setPriority(Priority.MEDIUM)
                .build()
                .getAsJSONObject(new JSONObjectRequestListener() {
                    @Override
                    public void onResponse(JSONObject response) {
                        // do anything with response
                    }
                    @Override
                    public void onError(ANError error) {
                        // handle error
                    }
                });


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source