👋 Enjoying the content? Subscribe to our Medium publication for more articles like this. 👇
Keep Learning

Upload File to Digital Ocean Space with PHP

BY Atakan Demircioğlu
Table of Contents

Here are my notes on uploading a file to Digital Ocean space with PHP.

Upload File to Digital Ocean Space with PHP image 1

Why use Digital Ocean Space?

If you are familiar with AWS S3, we can say it is a mirror thing in another Cloud provider. You can upload files, images, etc to a Digital Ocean space.

So there are many ways to use Digital Ocean Space, I just wrote a basic part uploading in base 64 format.

In my first letters, I said it is a mirror of S3. So we can use AWS SDK for uploading files to Digital Ocean Space.

Firstly install via composer;

composer require aws/aws-sdk-php

PHP Side

This is an example of uploading base 64 encodings, so on the client side, I am sending a string of image in base 64 formats to the backend.

A minor example for React side about how to convert to base64 string