Question

How to Upload a File/Resume(.doc and .pdf) in Object Storage Programatically

I have my code written in JQuery where I am uploading a file (resume) var input = document.getElementById('resumeFile); var file = input.files[0]; $.post({ url: “url of the space-object storage”, data : file, success: function(response) { alert(‘Success’+response); }, error: function(error) { alert(‘Failed’); }

I dont see the file in the space. Can someone throw some light where I am going wrong


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi,

Spaces requires authentication for uploads. I strongly recommend that you move this logic to the back-end as you definitely do not want your API key sent to all visitors to be used by client-facing jQuery—it gives everyone the ability to view all your Spaces and perform all kinds of operations on them including downloading all data and deleting it.

You should be able to use any S3-compatbile library so depending on which language the backend is written in. Here is an example for Node.js: https://www.digitalocean.com/community/tutorials/how-to-upload-a-file-to-object-storage-with-node-js

For reference, documentation on the Spaces API is available here: https://developers.digitalocean.com/documentation/spaces/