I`m using the following code post values using JSoup:
Document document = Jsoup.connect("http://www......com/....php")
.data("user","user","password","12345","email","info@tutorialswindow.com")
.method(Method.POST)
.execute()
.parse();
And now I want to submit a file, too. Like a form with a file field.
Is this possible ? If is than how ?
This is only supported since Jsoup 1.8.2 (Apr 13, 2015)
via the new
data(String, String, InputStream)method.In older versions, sending
multipart/form-datarequests is not supported. Your best bet is using a fullworthy HTTP client for this, such as Apache HttpComponents Client. You can ultimately get the HTTP client response asStringso that you can feed it toJsoup#parse()method.