Server side upload
See original GitHub issueI’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:
- Created 8 years ago
- Comments:9
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
@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