How to upload a file using Java HttpClient library working with PHP

前端 未结 10 2260
旧巷少年郎
旧巷少年郎 2020-11-22 08:48

I want to write Java application that will upload a file to the Apache server with PHP. The Java code uses Jakarta HttpClient library version 4.0 beta2:

impo         


        
10条回答
  •  时光取名叫无心
    2020-11-22 09:17

    Aah you just need to add a name parameter in the

    FileBody constructor. ContentBody cbFile = new FileBody(file, "image/jpeg", "FILE_NAME");
    

    Hope it helps.

提交回复
热议问题