Home >Backend Development >PHP Tutorial >如何上传远程图片啊,

如何上传远程图片啊,

WBOY
WBOYOriginal
2016-06-06 20:35:101319browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn