私は同僚のプログラムを取り戻します。コンソールでのエラーは、私が補強する方法がわからないしかしアップロードされたファイルの最大サイズを変更する方法Java Post
There was an error: the request was rejected because its size (68142301) exceeds the configured maximum (52428800)
ある
protected String uploadFile(File inputFile, String uuidFile) throws IOException,
ClientProtocolException {
HttpPost post = new HttpPost(new StringBuilder()
.append("http://xxxxxxxxxxxxx/FileServlet/").append("/uploadFile")
.toString());
post.addHeader("UuidFile", uuidFile);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
builder.addPart("file", new FileBody(inputFile));
HttpEntity httpEntity = builder.build();
post.setEntity(httpEntity);
CloseableHttpClient client = HttpClients.createDefault();
HttpResponse response = null;
try {
response = client.execute(post);
if (response.getStatusLine().getStatusCode() == 200) {
Pattern p = Pattern.compile("File uploaded into (.*)</h2>");
String messageErreur = IOUtils.toString(response.getEntity().getContent());
System.out.println(messageErreur);
Matcher m = p.matcher(messageErreur);
if (m.find()) {
return m.group(1);
}
} else {
throw new RuntimeException(response.getStatusLine().getStatusCode() + ": " + new String(IOUtils.toByteArray(response.getEntity().getContent())));
}
return null;
} finally {
client.close();
}
}
:
彼は、メソッドを(このプログラムは、サーバー上のファイルをアップロードすることができます)でしたアップロードされたファイルの最大サイズ...
アイデアはありますか?
おかげで、 アルノー
サーバはあなたに属しているんを変更する
を持っていましたか? – rmlan
サーバーはDEVサーバーです。私はuploadFile側サーバーのプログラムがありません。しかし、私はTomcat/webappに、サーバーの戦争と関連付けられているレパートリー(WEB-INF、META-INFを含む)を見る。私はレパートリーWEB-INFのweb.xmlをあなたの提案を追加して変更しましたが、機能しません...サーバ上のレパートリーのweb.xmlには "multipart-config"がありませんでした – ArnaudTheDevelopper