正在上传到 S3 但 Web 控制台中未显示任何内容

Uploading to S3 but nothing appears in the Web Console

我正在尝试将 CSV 文件上传到 AWS S3。我的代码没有语法错误,也没有导致任何异常,但 CSV 文件没有出现在 Web 控制台中。我还想按日期组织 CSV 文件。这是代码:

 string[] files = Directory.GetFiles(folder, "*.csv*", SearchOption.TopDirectoryOnly);

        foreach (string file in files)
        {
            PutObjectRequest request = new PutObjectRequest();
            request.BucketName = "WorkFolder";
            request.Key = "CSV/" + date + "/"; 
            request.FilePath = file;
            s3client.PutObject(request);
            response = s3client.PutObject(request);
        }

我找到了答案。我在密钥 属性 中遗漏了 "file name"。正确代码如下:

PutObjectRequest request = new PutObjectRequest();
request.BucketName = "WorkFolder"; 
request.Key = "CSV/" + date + "/" + file; // where file is the name of the file 
request.FilePath = s; 
s3client.PutObject(request);