How to delete files from Dropbox with PHP api

孤街醉人 提交于 2020-01-04 05:36:15

问题


First of all, I can properly upload and download files from Dropbox with the PHP api.

This is how I upload files:

// Upload files
$file = fopen("default.png", "rb");
$size = filesize("default.png");

$client->uploadFile("/default.png", Dropbox\WriteMode::add(), $file, $size);

This is how I download files:

// Download Files

$client->getFile("/default.png", fopen("default.png", "wb"));

Is there a api call to delete files from within the folder your app created. For example, my app creates a folder called Crave Crap. Inside, that folder is an image. That user only has access to that image within the folder Crave Crap within their Dropbox account for a short amount of time.

Is this possible?

EDIT - What API am I using? I'm not the best at answering this question. I have been following a video series here. I downloaded the api by using the terminal directly on composer.json.

Composer.json

{
  "require": {
    "dropbox/dropbox-sdk": "1.1.*"
  }
}

Code in Terminal

composer install

回答1:


It looks like you're using the Dropbox PHP Core SDK. To delete a file or folder using that SDK, you can use the delete method.

Using it would look like:

$client->delete("/default.png");


来源:https://stackoverflow.com/questions/34753340/how-to-delete-files-from-dropbox-with-php-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!