New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uploadFile error 4.0.15 #3303
Comments
@timershu please upgrade to 4.0.25.Final and try again. I think this was fixed before. If this is still an issue re-open. |
There is an exception, some file upload, but the contents of the documents not upload to the server |
@normanmaurer 4.0.25.Final Change package, bug still exists, the abnormal information is as follows。 |
@timershu I think it's because you call cleanFiles() before the actual response may be written. Use this: // test if request was chunked and if so, finish the write
if (bodyRequestEncoder.isChunked()) {
ChannelFuture cFuture=channel.writeAndFlush(bodyRequestEncoder);
cFuture.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
// Now no more use of file representation (and list of HttpData)
bodyRequestEncoder.cleanFiles();
}
});
} else {
channel.flush();
bodyRequestEncoder.cleanFiles();
} |
@timershu I don't understand... Can you explain what you try to say ? |
@normanmaurer we decide not to adopt this project because of its instability |
@normanmaurer In the day with 1000 files to be uploaded, occasionally only individual file upload failed |
@timershu I still not get your point... the exception you posted here is because you call cleanFiles() to early . That will be fixed by my change. |
@normanmaurer I would like to participate in this project, but the leaders feel that is not too stable, you need a change of plan. This random bug is how to produce? To provide under the relevant design data? |
@normanmaurer I am in accordance with you provided inside the demo to write |
@timershu did you apply the code suggested by @normanmaurer? You are using the code wrong it seems. |
@normanmaurer @daschl This problem is whether the individual files, file reason? |
mark~we have fixed in 4.0.26? |
Some file upload will be in error, some not
public static boolean uploadFile(Bootstrap b,final File file,String host,int port) throws Exception {
HttpDataFactory factory = new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE);
if (!file.canRead()) {
throw new FileNotFoundException(file.getAbsolutePath()+"/"+file.getName());
}
URI uriFile = new URI("/formpost/zhenai" );
// Start the connection attempt.
final ChannelFuture cf = b.connect(new InetSocketAddress(host, port));
// Connection established successfully
// Wait until the connection attempt succeeds or fails.
Channel channel = cf.sync().channel();
The text was updated successfully, but these errors were encountered: