gpt4 book ai didi

java - mDBapi.putfile 的变量?

转载 作者:行者123 更新时间:2023-11-29 21:49:29 24 4
gpt4 key购买 nike

我正在尝试使用 Dropbox API 从 ListView 上传文件。我的代码是:

 File file = new File(mFileMag.getCurrentDir() + "/" + item);
inputStream = new FileInputStream(file);
Entry newEntry = mDBApi.putFile(file, inputStream, //This is my issue
file.length(), null, null);

我的问题是,mDBapi.putfile 不能使用变量吗?我是否被迫使用硬编码字符串?尝试使用我的文件变量会导致:

“DropboxAPI 类型中的方法 putFile(String, InputStream, long, String, ProgressListener) 不适用于参数 (File, FileInputStream, long, null, null)”

最佳答案

docs for this call状态:

public DropboxAPI.Entry putFile(java.lang.String path, java.io.InputStream is,

...

path - the full Dropbox path where to put the file, including directories and filename. is - the InputStream from which to upload.

因此,'path' 应该是所需远程路径的字符串(在 Dropbox 上),'is' 是检索实际文件内容的方式。

看起来您正在尝试将文件对象本身作为“路径”传递,但您应该能够根据需要为所需路径构建字符串(可能包括原始名称。)

关于java - mDBapi.putfile 的变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14824123/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com