如何使用 PHP api 从 Dropbox 中删除文件 [英] How to delete files from Dropbox with PHP api

查看:24
本文介绍了如何使用 PHP api 从 Dropbox 中删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我可以使用 PHP api 从 Dropbox 正确上传和下载文件.

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"));

是否有 api 调用从您的应用程序创建的文件夹中删除文件.例如,我的应用创建了一个名为 Crave Crap 的文件夹.在里面,那个文件夹是一个图像.该用户只能在短时间内访问其 Dropbox 帐户中 Crave Crap 文件夹中的该图像.

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.

这可能吗?

编辑 - 我使用的是什么 API?我不是最擅长回答这个问题的.我一直在关注视频系列这里.我直接在 composer.json 上使用终端下载了 api.

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.*"
  }
}

终端中的代码

composer install

推荐答案

看起来您正在使用 Dropbox PHP 核心 SDK.要使用该 SDK 删除文件或文件夹,您可以使用 delete 方法.

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.

使用它看起来像:

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

这篇关于如何使用 PHP api 从 Dropbox 中删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆