php - curl: (26) 无法打开文件

标签 php api curl box-api

当我尝试通过 curl 调用 box api 时,出现此错误。

curl: (26) couldn't open file

找不到原因!我正在使用正确的文件名调用此 api-

curl https://upload.view-api.box.com/1/documents \
-H "Authorization: Token YOUR_API_TOKEN" \
-H "Content-type: multipart/form-data" \
-F file=@A_correct_file_name

我已经看到了所有三个已经提出的问题,但其中 2 个没有得到回答,一个是特定于 Facebook 的。

cURL error 26 couldn't open file

Fatal error: Uncaught CurlException: 26: couldn't open file "" thrown in

Getting Fatal Error Uncaught CurlException: 26: couldn't open file

最佳答案

我在更改为 PHP 5 后遇到了类似的问题(我使用的是 @ 上传方法,但它已被弃用,所以我不得不开始使用 CURLFile),在这个 stack 中找到了我的问题的解决方案.

解决方案:curl 上传不适用于相对路径,请改用完整路径

关于php - curl: (26) 无法打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23730283/

相关文章:

php - 使用 PDO PHP 自动化 mysqldump,可能吗?

php - Yii2 - beforeAction 期间的返回响应

api - 如何从随机 subreddit 中提取随机帖子? (Reddit API)

api - 特雷洛 API : Getting invalid token on all calls

javascript - 如何使用 'new' 从另一个函数/对象中的函数创建对象

java - 问题: curl: (7) Failed to connect to localhost port 1080: Connection refused

php - 使用 PHP (PDFLib) 编写 PDF

php - 使用 lightopenid/注销保留登录信息

linux - 在 Shell 脚本中根据 curl 输出分配变量

C++ 添加 libcurl(使用 Curl)? - 我的尝试解释