Skip to content

Commit

Permalink
User Image implementation (Updated) issue #44
Browse files Browse the repository at this point in the history
  • Loading branch information
Syed Asher Ahmed committed Apr 1, 2017
1 parent 85318c9 commit 8687829
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion imports/startup/server/aws.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Meteor.startup(() => {
},
key: function (file, metaContext) {
// image url with ._id attached:
return metaContext.uploaderId + "/" + Date.now() + "-" + file.name.replace(/\s/g, '_');
return metaContext.uploaderId + "/" + metaContext.folder + '/' + Date.now() + "-" + file.name.replace(/\s/g, '_');
}
});
});
1 change: 1 addition & 0 deletions imports/ui/components/expenses/ExpensesSideBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ class ExpensesSideBar extends Component {
reader.readAsDataURL(file);

let metaContext = {
folder: "bills",
uploaderId: userId
};

Expand Down
3 changes: 1 addition & 2 deletions imports/ui/components/settings/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ class SettingsPage extends Component {

let userId = Meteor.user()._id;
let metaContext = {
folder: "profiles",
uploaderId: userId
};

let uploader = new Slingshot.Upload('imageUploader', metaContext);
uploader.send(this.state.target, (error, downloadUrl) => { // you can use refs if you like
if (error) {
Expand Down Expand Up @@ -277,7 +277,6 @@ class SettingsPage extends Component {
target: e.target.files[0]
})
reader.onload = (upload) => {
console.log(upload);
this.setState({
data_uri: upload.target.result
});
Expand Down

0 comments on commit 8687829

Please sign in to comment.