Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Commit

Permalink
Kvittevitte vit bumbum...
Browse files Browse the repository at this point in the history
  • Loading branch information
dani832m committed Dec 17, 2019
1 parent 5ee1b9a commit bd6f0e8
Showing 1 changed file with 25 additions and 37 deletions.
62 changes: 25 additions & 37 deletions src/components/addNewScooter/AddNewScooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,43 +94,31 @@ function AddNewScooter() {

// Håndtér ændring af billede
const handleImageChange = event => {
var params = {
Body: 'The contents of the file',
Bucket: 'tukka',
Key: 'file.ext',
ACL: 'public-read'
};

s3.putObject(params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
});

// if (event.target.files && event.target.files[0]) {
// const blob = event.target.files[0];
// const params = {
// Body: blob,
// Bucket: 'https://tukka.fra1.digitaloceanspaces.com',
// Key: blob.name
// };
// // Uploader filen til DO Space
// s3.putObject(params)
// .on('build', request => {
// request.httpRequest.headers.Host =
// 'https://tukka.fra1.digitaloceanspaces.com/';
// request.httpRequest.headers['Content-Length'] = blob.size;
// request.httpRequest.headers['Content-Type'] = blob.type;
// request.httpRequest.headers['x-amz-acl'] = 'public-read';
// })
// .send(err => {
// if (err) handleImageError();
// else {
// const imageUrl =
// 'https://tukka.fra1.digitaloceanspaces.com/' + blob.name;
// console.log(imageUrl);
// }
// });
// }
if (event.target.files && event.target.files[0]) {
const blob = event.target.files[0];
const params = {
Body: blob,
Bucket: 'https://tukka.fra1.digitaloceanspaces.com',
Key: blob.name
};
// Uploader filen til DO Space
s3.putObject(params)
.on('build', request => {
request.httpRequest.headers.Host =
'https://tukka.fra1.digitaloceanspaces.com/';
request.httpRequest.headers['Content-Length'] = blob.size;
request.httpRequest.headers['Content-Type'] = blob.type;
request.httpRequest.headers['x-amz-acl'] = 'public-read';
})
.send(err => {
if (err) handleImageError();
else {
const imageUrl =
'https://tukka.fra1.digitaloceanspaces.com/' + blob.name;
console.log(imageUrl);
}
});
}
};

// Håndtér indsendelse af elscooteroplysninger
Expand Down

0 comments on commit bd6f0e8

Please sign in to comment.