0

I backup my mysql database each day and I want to use dropbox to upload mysql file.sql each day.

Right now I use the dropbox api I have already created the app console. How can I upload automatically my file.sql using dropbox api?

this is my code:

    $dropboxKey = " key";
    $dropboxsecret = "secret";
    $appname = "backupsql";

    $appInfo = new Dropbox\AppInfo($dropboxKey,$dropboxsecret);

    // upload
    // upload
    // what should i write here to automatically upload wi
Arun Vinoth - MVP
  • 21,521
  • 14
  • 57
  • 157
  • Your need to [dump the database](https://stackoverflow.com/questions/6750531/using-a-php-file-to-generate-a-mysql-dump), then I suppose you would use [uploadFile()](https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/source-class-Dropbox.Client.html#274). – Lawrence Cherone Dec 16 '17 at 12:27
  • Or install dropbox on the server, dump the file and move it to the synced folder. – Lawrence Cherone Dec 16 '17 at 12:28
  • Or use [flysystem](https://flysystem.thephpleague.com/adapter/dropbox/), just in case dropbox don't work out, or you want to use some other storage backend without changing/implementing much. – Lawrence Cherone Dec 16 '17 at 12:30
  • yes already i have dump mydatabase i want just to know how can i upload the file using dropbox api can you write me an example please – Amine Bouhaddi Dec 16 '17 at 13:37
  • There is an example in the docs here: https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/source-class-Dropbox.Client.html#235 – Lawrence Cherone Dec 16 '17 at 13:40
  • must i initialize $client ? – Amine Bouhaddi Dec 16 '17 at 13:51
  • https://github.com/dropbox/dropbox-sdk-php/blob/master/examples/upload-file.php Have a look at the API docs on how to use the lib. Yuo downloaded it from somewhere. – Lawrence Cherone Dec 16 '17 at 13:54
  • its ok, but i get an error message : Type: Dropbox\Exception_BadRequest Message: HTTP status 400 {"error": "v1_retired"} – Amine Bouhaddi Dec 16 '17 at 14:06
  • i'musing wamp 64 – Amine Bouhaddi Dec 16 '17 at 14:06
  • The PHP SDK you're using is for Dropbox API v1, which is [retired](https://blogs.dropbox.com/developers/2017/09/api-v1-shutdown-details/). You will need to use [API v2](https://www.dropbox.com/developers) instead. There are some third party PHP libraries for that [listed here](https://www.dropbox.com/developers/documentation/communitysdks). – Greg Dec 18 '17 at 15:08

0 Answers0