Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- axios.get('/picture', {params: { filename: `${this.props.user.id}_${Date.now()}`}})
- .then(response =>{
- var signedUrl = response.data;
- var headers= {
- 'ACL': 'public-read',
- 'Content-Type': this.state.imageType,
- };
- return axios.put(signedUrl, this.state.imgSrc, headers);
- })
- const s3 = new aws.S3({
- region: 'us-east-2',
- accessKeyId: process.env.ACCESS_KEY_ID,
- secretAccessKey: process.env.SECRET_ACCESS_KEY,
- router.get('/', (req,res)=>{
- let params = {
- Bucket: 'beerphotos',
- Key: req.query.filename,
- //Body : req.query.picture[0],
- ACL: 'public-read',
- ContentType: 'image/png',
- Expires: 60,
- }
- s3.getSignedUrl('putObject', params, function(err, data) {
- if (err) {
- console.log('Error Getting Signed URL', err);
- return err;
- } else {
- console.log('This is the data', data)
- res.send(data);
- }
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement