【发布时间】:2023-03-29 10:49:01
【问题描述】:
我已经编写了 AWS Lambda 代码,我需要将图像存储在 aws lambda 的 /tmp 位置。以下是我的代码:
String fileLocation = "loc1/loc2/";
String imageNameWithoutExt = "image1";
//creating directories first below storing the image
boolean status = new File("/tmp/"+fileLocation).mkdirs();
if(status == true){
File targetFile = File.createTempFile(imageNameWithoutExt,".jpg",new File("/tmp/"+fileLocation));
FileOutputStream outStream = new FileOutputStream(targetFile);
outStream.write(buffer);
outStream.close();
}else{
System.out.println("unable to create directory inside /tmp/");
}
作为响应,它正在打印 else 语句:
unable to create directory inside /tmp/
我需要进行哪些修改才能从 /tmp 位置写入和读取文件。任何帮助将不胜感激。
【问题讨论】:
标签: java amazon-web-services amazon-s3 aws-lambda