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

前端 未结 10 2139
旧巷少年郎
旧巷少年郎 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:28

    For those having a hard time implementing the accepted answer (which requires org.apache.http.entity.mime.MultipartEntity) you may be using org.apache.httpcomponents 4.2.* In this case, you have to explicitly install httpmime dependency, in my case:

    
        org.apache.httpcomponents
        httpmime
        4.2.5
    
    

提交回复
热议问题