It is sometimes useful to upload a file or files to Dropbox from the terminal or even by script. This snippet uploads a file to the directory’s root.

curl -X POST https://content.dropboxapi.com/2/files/upload --header "Authorization: Bearer <auth code> " --header "Dropbox-API-Arg: {\"path\": \"/filename.png\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}" --header "Content-Type: application/octet-stream" --data-binary @filename.png