如何使用post方法上传带有参数android的图像(How to upload a image with parameters android with post method)
我正在关注此链接上传图片。 我成功发送图像。
但是如何使用相同的请求发送一些参数。
我想发送这些参数
String urlFormation = WebConstants.UPLOAD_IMAGE; Log.i(TAG, "urlFormation: ======"+urlFormation); URL url = new URL(urlFormation); // Open a HTTP connection to the URL conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("user_id", userID); conn.setRequestProperty("release_id", releaseID);请帮帮我。 谢谢
I am following this link to upload a image. I am successfully sending image.
But how to send some parameters with same request.
These parameters i want to send
String urlFormation = WebConstants.UPLOAD_IMAGE; Log.i(TAG, "urlFormation: ======"+urlFormation); URL url = new URL(urlFormation); // Open a HTTP connection to the URL conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("user_id", userID); conn.setRequestProperty("release_id", releaseID);Please help me. Thank you
最满意答案
好的方法是使用GET
yourscript.php?parm1=somevalue¶m2=someothervalue如果您想要POST ,可以将数据附加到请求正文。
Well the easy way is to use GET
yourscript.php?parm1=somevalue¶m2=someothervalueIf you wanted POST you can append the data to the body of the request.
更多推荐
发布评论