Untitled
unknown
plain_text
2 years ago
951 B
12
Indexable
public void populateFileCode(String url, File file, JPanel panel) {
HttpPost httpPost = new HttpPost(url);
System.out.println(file + " uploading ...");
FileBody uploadFilePart = new FileBody(file);
MultipartEntityBuilder builder = MultipartEntityBuilder.create()
.setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
.setCharset(Charset.forName("UTF-8"))
.addPart("file", (ContentBody)uploadFilePart);
httpPost.setEntity(builder.build());
try {
Exception exception1 = null, exception2 = null;
try {
} finally {
exception2 = null;
if (exception1 == null) {
exception1 = exception2;
} else if (exception1 != exception2) {
exception1.addSuppressed(exception2);
}
}
} catch (IOException exp) {
exp.printStackTrace();
JOptionPane.showMessageDialog(panel, "File server is not working.",
"Error", 0);
}
}Editor is loading...