Hey all! I am trying to post a file over Http using Java 1.4.2. I have found some great examples using HttpClient and HttpPost but HttpPost requires a higher JDK than 1.5 which I cannot use.
I have tried downloading the Apache HttpClient 3.1 legacy version, which is compatible with 1.4.2, but it does not contain HttpPost.
Does anyone have any good and simple examples of posting a couple of strings and a file to a html form?
An optimal solution would be one that streams the file to the form and does not load it all at once since some of our files “could” be large.
Thanks!
Updating notwithstanding, HttpClient 3.x is able to do POST requests using
PostMethod: see the old documentation and the javadocs.You should be able to stream the files by using
setRequestBody(InputStream).