我有一个大小为800KB的JPG文件。我试图上传到S3,但一直收到超时错误。请问出了什么问题吗? 800KB 对于上传来说相当小。
错误消息:您的套接字连接在超时期内未被读取或写入。空闲连接将被关闭。
HTTP状态码:400
AWS错误代码:RequestTimeout
Long contentLength = null;
System.out.println("Uploading a new object to S3 from a file\n");
try {
byte[] contentBytes = IOUtils.toByteArray(is);
contentLength = Long.valueOf(contentBytes.length);
} catch (IOException e) {
System.err.printf("Failed while reading bytes from %s", e.getMessage());
}
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(contentLength);
s3.putObject(new PutObjectRequest(bucketName, key, is, metadata));