Ask A Question

Notifications

You’re not receiving notifications from this thread.

Uploading a PDF file directly into Sharefile via their API

Amanda asked in Rails

I need to upload multiple large PDF files directly into a ShareFile Folder (https://api.sharefile.com/samples/ruby). Right now I am reading and saving the file data as binary data in a model and then calling it in a background job to be uploaded into ShareFile. I find that I am running out of memory in Heroku. I am sure there is a better way to do this. Any pointers/tips would be greatly appreciated.

The files have to go into ShareFile.

Thank you very much.

Reply

To upload a PDF file directly into ShareFile via their API, you would typically follow these general steps:

Authentication: You need to authenticate with ShareFile's API using your account credentials or an API key.

Prepare the File: You should prepare the PDF file you want to upload. Ensure that you have its binary data ready to be sent over the API.

Upload the File: Use the ShareFile API's endpoint for file upload to send the PDF file data.

Remember to replace placeholders like YOUR_SUBDOMAIN, YourFolderID, your_client_id, your_client_secret, your_username, your_password, and path_to_your_pdf_file.pdf with your actual ShareFile subdomain, folder ID, client ID, client secret, username, password, and the path to your PDF file.

Ensure you handle errors and exceptions properly, and consider security practices such as storing credentials securely and handling access tokens securely. Additionally, you may need to adjust the code according to ShareFile API documentation and any specific requirements or limitations of your use case.

Reply

Very useful sharing. Thanks

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,823+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.