question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server side upload

See original GitHub issue

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);
   }
});

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:9

github_iconTop GitHub Comments

9reactions
aadamsxcommented, 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.

2reactions
shivang007commented, May 15, 2018

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Client-side file upload or server-side file upload. Which one is ...
In this article, I'll discuss the difference between server-side and client-side file upload and why client-side is a better choice.
Read more >
Server Side Implementation - Dropzone.js
Server Side Implementation. How to handle uploaded files on the server. Dropzone does not provide the server side implementation of handling the files....
Read more >
Writing Server-Side Upload Code - Image Uploader 6.5 Dual
Writing Server-Side Upload Code. Image Uploader is a pure client-side software. It means that it does not perform any actions on the server....
Read more >
Server side file upload - ImageKit.io Docs
You can upload files to the ImageKit.io media library from your server-side using private API key authentication.
Read more >
aspx.net uploading files to a server side - Stack Overflow
I've been trying to do this for a few days and I couldn't fix it. I managed to upload a file from a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found