开发者社区> 问答> 正文

RequestTimeout如何解决啊

[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>";


展开
收起
ddonng 2011-11-27 00:34:40 12164 0
3 条回答
写回答
取消 提交回答
  • 请联系OSS客服

    2392587194
    2011-12-02 17:27:48
    赞同 展开评论 打赏
  • ?不是每次添加进去么??等号前面有个点的嘛?求指教啊,测试行的给我说下嘛
    2011-11-28 23:41:19
    赞同 展开评论 打赏
  • 代码有问题吧,
        while(!feof($fp)){
            $content .= fgets($fp,8192);
        }
    }
    $upload_file_options = array(
        'content' => $content,
        'length' => $length,
    );
    content只读了一次吧?

    -------------------------

    //伪代码
    while(true)
    {
          length = 读文件(buf, 1024)
           if (length 有效)
              上传文件(buf, length)
         else
               break;
    }

    2011-11-28 14:50:13
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Android插件化-从入门到"放弃" 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载