[font='Times New Roman'] RequestTimeout Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed。
上传不了啊,用的是demo里的代码
$bucket = 'education';
$filename = 'mypic.gif';
//$file = "D:\\".$filename;
$file = $filename;//从当前目录下找到这个文件
$file = iconv("UTF-8", "GBK", $file);
$object = 'aa/'.$filename;
$content = '';
$length = 0;
$fp = fopen($file,'r');
if($fp){
$f = fstat($fp);
$length = $f['size'];
while(!feof($fp)){
$content .= fgets($fp,8192);
}
}
$upload_file_options = array(
'content' => $content,
'length' => $length,
);
var_dump($upload_file_options);exit;
$upload_file_by_content = $oss_sdk_service->upload_file_by_content($bucket,$object,$upload_file_options);
echo "<p>通过http body上传文件</p>";
//print_r($upload_file_by_content);
echo "<p></p>";
-------------------------
//伪代码
while(true)
{
length = 读文件(buf, 1024)
if (length 有效)
上传文件(buf, length)
else
break;
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。