欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

如何上传远程图片啊,

程序员文章站 2022-05-23 23:53:30
...

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);

相关标签: php