将图像作为(字节数组)从android上传到asp.net mvc服务器

时间:2019-04-03 13:01:48

标签: android asp.net model-view-controller asynchttpclient

我在Android中使用asynchttpclient将图像((字节数组))上传到服务器

byte[] bytes;  //incommming bytes


RequestParams params = new RequestParams();
        params.put("imgBytes",new ByteArrayInputStream(bytes));

        ServerConnection.get("saveImage", params, new TextHttpResponseHandler() {
            @Override
            public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
                Log.d(TAG, "uploadByteArrayPhoto: onFailure: uploading failed "+responseString +" throwable :  "+throwable.getMessage() );
            }

            @Override
            public void onSuccess(int statusCode, Header[] headers, String responseString) {

                Log.d(TAG, "uploadByteArrayPhoto: onSuccess: uploading success "+responseString);
            }
        });

所以我的问题是如何在服务器端(asp.net MVC C#)

我需要 MVC 控制器中的函数来处理此 ByteArrayInputStream 并将其覆盖到图像文件(PNG / JPEJ)中,然后将其保存在服务器中, 因此,我可以将图片网址存储在SQL中

0 个答案:

没有答案