使用AWS凭证将CSV文件上传到Amazon

使用AWS凭证将CSV文件上传到Amazon

本文介绍了React JS:使用AWS凭证将CSV文件上传到Amazon S3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用react S3 Uploader上传CSV文件.我也有AWS凭证.但是我不知道如何在React JS中使用它.

I want to upload CSV file using react S3 Uploader. I have AWS credentials as well. But I don't know how to use it in React JS.

下面是我使用的代码.

import React, { PureComponent } from "react";
import ReactS3Uploader from "react-s3-uploader";


 saveUploaderReference = uploader => {
    if (uploader) {
      this.uploaderReference = uploader;
    }
  };


  getSignedUrl = (file) => {
     console.log("File : " , file)
  };




<ReactS3Uploader
            ref={this.saveUploaderReference}
            getSignedUrl={this.getSignedUrl}
            s3path="temp/"
            uploadRequestHeaders={{}}
            contentDisposition="auto"
            scrubFilename={filename => this.filename}
            autoUpload={true}
            multiple={false}
          />

我不知道在哪里使用AWS凭证.

I don't know where to use AWS credentials.

我有accessKeyID&secretAccessID.我不知道在哪里使用.

I have accessKeyID & secretAccessID. I don't know where to use it.

任何帮助都会很棒.

谢谢.

推荐答案

正如Radu Diță在第二个选项中已经提到的那样,请使用AWS Cognito.无需设置自己的后端服务器+ API.

As Radu Diță mentioned already in the second option, use AWS Cognito for that. No need to setup your own backend server + API.

此外,在使用React + AWS进行开发时,Amplify还可以为您提供帮助.

Also, Amplify helps you when you develop with React + AWS.

这是您的情况的一个很好的例子: https://serverless-stack.com/chapters/create-a-login-page.html

Here is a good example for your scenario:https://serverless-stack.com/chapters/create-a-login-page.html

这篇关于React JS:使用AWS凭证将CSV文件上传到Amazon S3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 03:20