【问题标题】:How to upload image file from Android to ASP.NET(Web Services- ASMX) upload folder using Retrofit如何使用 Retrofit 将图像文件从 Android 上传到 ASP.NET(Web Services-ASMX) 上传文件夹
【发布时间】:2020-01-13 17:43:09
【问题描述】:

请帮我为我提供解决方案,因为我尝试了很多代码并且参考了很多教程,但每个人的结果都不一样。

所以请大家帮帮我

【问题讨论】:

    标签: android asp.net web-services retrofit


    【解决方案1】:

    您可以尝试使用 Koush ION,Here is the GitHub,也可以扩展您的问题是否有任何错误,究竟是什么问题......下次您提出问题时,您应该添加代码 sn-ps 和对问题的完整解释......您将有更好的机会获得答案......所以在 koush ION 中,它易于使用

    实现库
    implementation 'com.koushikdutta.ion:ion:2.2.1 
    

    然后调用它

     Ion.with(SecondActivity.this)
                    .load(myURL)-Enter your URL here
                    .uploadProgressDialog(pd)
                    .setMultipartFile("pdf","pdf/*",filePath )-here you set the type and location of the file
                    .asJsonObject()
                    .setCallback(new FutureCallback<JsonObject>() { - here you get results from the server using a json array/object
                        @Override
                        public void onCompleted(Exception e, JsonObject result) {
                            String message = result.get("message").getAsString();
                            Toasty.info(SecondActivity.this, message, Toast.LENGTH_LONG).show();-here i use the Toasty library for awesome looking toast messages
    

    【讨论】:

      猜你喜欢
      • 2020-01-14
      • 1970-01-01
      • 2020-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-02
      • 2014-05-02
      • 1970-01-01
      相关资源
      最近更新 更多