RequestTimeout如何解决啊-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

RequestTimeout如何解决啊

ddonng 2011-11-27 00:34:40 11373
[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>";


分享到
取消 提交回答
全部回答(3)
  • leo.zhouw
    2011-12-02 17:27:48
    请联系OSS客服

    2392587194
    0 0
  • ddonng
    2011-11-28 23:41:19
    ?不是每次添加进去么??等号前面有个点的嘛?求指教啊,测试行的给我说下嘛
    0 0
  • lei.zhuol
    2011-11-28 14:50:13
    代码有问题吧,
        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;
    }

    0 0
添加回答
云计算
使用钉钉扫一扫加入圈子
+ 订阅

时时分享云计算技术内容,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。

推荐文章