Error: Server error: couldn't open file “Capture.png”

橙三吉。 提交于 2020-01-16 00:39:14

问题


I want to post an image on twitter but I can't. I am able to post only text message with twitter API.

The error is: Error: Server error: couldn't open file "Capture.png"

I use wamp server. The picture is in the same folder with the script.

Where is the problem?

require_once '../src/twitter.class.php';

// ENTER HERE YOUR CREDENTIALS (see readme.txt)
$twitter = new Twitter. ('raQBedybFLb', 'HWgN6Qt11jg0LY', '862846056-ndeGfMA83r9ldh', 'VMBvHDahXnGp');
$p='./Capture.png';
try {
$tweet = $twitter->send('testing twitter api', $p); // you can add $imagePath as second argument

} catch (TwitterException $e) {
echo 'Error: ' . $e->getMessage();
}

回答1:


You may use $p = realpath('Capture.png');



来源:https://stackoverflow.com/questions/24274039/error-server-error-couldnt-open-file-capture-png

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