HttpURLConnection, how to sending parameters via post?

前端 未结 2 643
予麋鹿
予麋鹿 2021-01-29 04:52
    String pathToOurFile = \"/sdcard/DCIM/Camera/foto.jpg\";
    String urlServer = \"http://server/upload.php\";        
    String lineEnd = \"\\r\\n\";
    String two         


        
2条回答
  •  滥情空心
    2021-01-29 05:05

    for each parameter, where paramName=paramData:

    outputStream.writeBytes(twoHyphens + boundary + lineEnd);
    outputStream.writeBytes('Content-Disposition: form-data; name="paramName"' + lineEnd);
    outputStream.writeBytes(lineEnd);
    outputStream.writeBytes(paramData);
    

提交回复
热议问题