Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server side upload #164

Open
aadamsx opened this issue Jan 26, 2016 · 9 comments
Open

Server side upload #164

aadamsx opened this issue Jan 26, 2016 · 9 comments

Comments

@aadamsx
Copy link

aadamsx commented Jan 26, 2016

I'm creating a PDF file server side, and would like to do a Slingshot.Upload but I get an error when trying. As a side note I can do this just fine on the client and can call Slingshot.createDirective just fine on the server side.

I'd like to do something like this server side:

var files = Meteor.settings.directory_path + userId + "/pdf-file.pdf";
  var uploader = new Slingshot.Upload("dropbox"); <-- !! I get an error here !!
  uploader.send(file, function (error, downloadUrl) {
    if (error) {
      console.error('Error uploading', uploader.xhr.response);
      alert (error);
    }
    else {
      var ownerId = userId; 
      var addedById = this.userId;
      var name = uploader.file.name;
      var type = uploader.file.type;
      var size = uploader.file.size;

      var fullPath = downloadUrl;
      var directory = userId;

      var indexOfDirectory = fullPath.indexOf(directory);
      var indexOfStringLength = fullPath.length;
      var key = fullPath.slice(indexOfDirectory, indexOfStringLength);
   }
});
@aadamsx
Copy link
Author

aadamsx commented Jan 26, 2016

It seems I might need to use Slingshot.S3Storage.upload on the server side, does anyone an example with parameters?

@aadamsx
Copy link
Author

aadamsx commented Jan 26, 2016

I've almost got things working using AWS.S3() directly instead. I don't understand if Slingshot.S3Storage.upload is the right server API to use.

Is anyone monitoring/maintaining this package anymore or is abandoned? If it is, please designate someone else to take over, I see a lot of PRs just standing just standing idle. Everyone will understand, as these things suck your time away. But this is too important of a package to leave standing.

@jaredtmartin
Copy link

I'm trying to do the same thing. Have you had any success?

@bmustata
Copy link

bmustata commented Nov 9, 2016

Any update on this issue?

@acomito
Copy link

acomito commented Feb 18, 2017

also trying to do this

@StorytellerCZ
Copy link

@aadamsx Did you found a solution?

@shivang007
Copy link

Any progress on this one?

@formspoint
Copy link

Indeed, I got his working a few years ago. If you need help, PM me.

@shivang007
Copy link

@formspoint Thank you! But I figured out, instead of modifying this, using the AWS SDK's upload method would be a simple and clean solution.
And for anyone in the future stuck at figuring out "How to upload from server using slingshot", please avoid the modification and check this out:
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#upload-property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants