当前位置:Gxlcms > PHP教程 > 如何上传远程图片啊,

如何上传远程图片啊,

时间:2021-07-01 10:21:17 帮助过:17人阅读

include_once('upyun.class.php');
$fb=fopen('http://www.baidu.com/img/bdlogo.png','rb');
$filename='/video/test.jpg';
$upload = new UpYun('test', 'test', 'test123');
$upload ->writeFile("$filename", $fb, True);
fclose($fb);

我上传完报错什么原因呢,

回复内容:

include_once('upyun.class.php');
$fb=fopen('http://www.baidu.com/img/bdlogo.png','rb');
$filename='/video/test.jpg';
$upload = new UpYun('test', 'test', 'test123');
$upload ->writeFile("$filename", $fb, True);
fclose($fb);

我上传完报错什么原因呢,

已经解决了:
include_once('upyun.class.php');
$fb=file_get_contents('http://www.baidu.com/img/bdlogo.png');
$filename='/video/test.jpg';
$upload = new UpYun('test', 'test', 'test123');
$upload ->writeFile("$filename", $fb, True);
fclose($fb);

人气教程排行