【发布时间】:2015-08-15 19:56:47
【问题描述】:
在我查看的每个站点上,他们都说wrong file path 会导致此错误,但我确信我的路径是正确的,并且昨晚有效,为什么今晚不行??!!
为证明路径正确,file_exists($path)返回true。
我想使用 Curl 发送文件,我得到了failed creating formpost data。我给 Curl 的文件路径如下:
define('ASSET_PATH', dirname(dirname(dirname(__FILE__))) . '/asset');
$postfields = array(
'chat_id' => $user->user_id,
'caption' => $asset->caption,
'duration' => $asset->duration,
'video' => "@" . ASSET_PATH . "/video/" . $asset->name,
);
当你看到$postfields['video']的值时,输出是:
/home/hosseins/domains/my_domain/public_html/telegram/asset/video/Bottle_Bank.mp4
更多代码
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$result = curl_exec($ch);
echo curl_error ( $ch ); //return failed creating formpost data
echo '<br />' . ASSET_PATH . "/video/" . $asset->name; //return named path
curl_close($ch);
我的地址有什么问题或来自其他地方的问题吗?
伙计们,我被困在这里,任何帮助将不胜感激。
提前致谢
【问题讨论】:
-
您好,我也在使用 sendVideo,但是我在这里遇到了这个问题:stackoverflow.com/questions/31961690/…您有这样的问题吗?