How to upload files to Dropbox with PHP put method using Curl

By Clain Dsilva May 2, 2016
php curl dropbox file puload Put Method

Hi all, today I will explain you about how easily you can upload a file to dropbox with PHP and http put method. First of all we will take a look at what are the requirements.

  1. PHP server with Curl extension installed [well most of it does come with curl installed]
  2. Dropbox Access Token [ you can easily generate it from your drobox api account ]

Set up your Url , Filepath and  Access Token

Initialize curl and add custom method PUT

Read the file and make the Curl parameters

Make the curl HTTP request and get the response

Final Complete Code

Things to Remember

  • The Access Token should not be made visible to public, hence in production environment make sure you have an error free code [ including warning and notices] .
  • Make sure you do not upload very large files wile making a request from a web server, this can result in timeouts, for larger files its best to execute this code from a CLI / Bash Shell where there are no timeouts.

Hope you have enjoyed the post, Please do post your comments and suggestions.

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
How to upload files to Dropbox with PHP put method using Curl, 5.0 out of 5 based on 1 rating

Leave a Reply

Your email address will not be published. Required fields are marked *