Skip to content

Commit

Permalink
Merge pull request #83 from ogourment/xhr
Browse files Browse the repository at this point in the history
expose xhr in uploader
  • Loading branch information
gsuess committed Mar 29, 2015
2 parents 54c10e0 + f7a132e commit d9af24f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Slingshot Changelog
===================

## Version 0.6.1

### Enhancements

* Added a way to get the server response to the uploader. ([#82](https://github.com/CulturalMe/meteor-slingshot/issues/82))

## Version 0.6.0

### Bug Fixes
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
meteor-slingshot
meteor-slingshot
================

[![](https://api.travis-ci.org/CulturalMe/meteor-slingshot.svg)](https://travis-ci.org/CulturalMe/meteor-slingshot) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/CulturalMe/meteor-slingshot?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Expand Down Expand Up @@ -38,7 +38,14 @@ On the client side we can now upload files through to the bucket:
var uploader = new Slingshot.Upload("myFileUploads");

uploader.send(document.getElementById('input').files[0], function (error, downloadUrl) {
Meteor.users.update(Meteor.userId(), {$push: {"profile.files": downloadUrl}});
if (error) {
// Log service detailed response
console.error('Error uploading', uploader.xhr.response);
alert (error);
}
else {
Meteor.users.update(Meteor.userId(), {$push: {"profile.files": downloadUrl}});
}
});
```

Expand Down
1 change: 1 addition & 0 deletions lib/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ Slingshot.Upload = function (directive, metaData) {
});

xhr.send(buildFormData());
self.xhr = xhr;

return self;
},
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package.describe({
name: "edgee:slingshot",
summary: "Directly post files to cloud storage services, such as AWS-S3.",
version: "0.6.0",
version: "0.6.1",
git: "https://github.com/CulturalMe/meteor-slingshot"
});

Expand Down

0 comments on commit d9af24f

Please sign in to comment.