I have one requirement in my app say. I need to get the content of the file from disk and send it to some external URL and want to confirm the external URL got the content or not.
In my Application user can select one document and say viewer so that it will display selected file converted version. For the conversion of that file I need to send selected file to .Net application URL which will convert it in the 3D modeling file and display response on my browser.
Here is my code which I am using to send the file first.
try{
File f = new File("/home/Desktop/rename.txt");
PostMethod filePost = new PostMethod("external URL");
Part[] parts = { new FilePart("file", f) };
filePost.setRequestEntity(new MultipartRequestEntity(parts,
filePost.getParams()));
HttpClient client = new HttpClient();
int status = client.executeMethod(filePost);
System.out.println(status);
}catch(Exception e){
e.printStackTrace();
}