在我的php代码中,此方法move_uploaded_file()始终返回false并且移动上传文件失败!我只是检查变量值,它们没问题。
这是我的代码behide。
for (NetworkAddress address : addresses) {
if (isConnectedTo(address)) {
continue;
}
try {
SocketChannel channel = SocketChannel.open();
channel.configureBlocking(false);
channel.connect(new InetSocketAddress(address.toInetAddress(), address.getPort()));
// admittedly, 20 seconds is quite long
long timeout = System.currentTimeMillis() + 20_000;
while (!channel.finishConnect() && System.currentTimeMillis() < timeout) {
// Without this loop, I get said exception
}
if (!channel.finishConnect()) {
channel.close();
continue;
}
ConnectionInfo connection = new ConnectionInfo(ctx, CLIENT,
address,
listener,
requestedObjects, 0
);
connections.put(
connection,
channel.register(selector, OP_READ | OP_WRITE, connection)
);
} catch (NoRouteToHostException | AsynchronousCloseException ignore) {
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}
}
我还在文件夹上设置了777权限