{"action":"created","issue":{"url":"https://api.github.com/repos/johnlui/AliyunOSS/issues/3","labels_url":"https://api.github.com/repos/johnlui/AliyunOSS/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/johnlui/AliyunOSS/issues/3/comments","events_url":"https://api.github.com/repos/johnlui/AliyunOSS/issues/3/events","html_url":"https://github.com/johnlui/AliyunOSS/issues/3","id":95341876,"number":3,"title":"文件没有正确关闭的bug","user":{"login":"shoaly","id":2660914,"avatar_url":"https://avatars.githubusercontent.com/u/2660914?v=3","gravatar_id":"","url":"https://api.github.com/users/shoaly","html_url":"https://github.com/shoaly","followers_url":"https://api.github.com/users/shoaly/followers","following_url":"https://api.github.com/users/shoaly/following{/other_user}","gists_url":"https://api.github.com/users/shoaly/gists{/gist_id}","starred_url":"https://api.github.com/users/shoaly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoaly/subscriptions","organizations_url":"https://api.github.com/users/shoaly/orgs","repos_url":"https://api.github.com/users/shoaly/repos","events_url":"https://api.github.com/users/shoaly/events{/privacy}","received_events_url":"https://api.github.com/users/shoaly/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-16T03:37:01Z","updated_at":"2015-08-07T15:23:16Z","closed_at":null,"body":"在AliyunOSS 中, 传入的$file 其实是 filepath, 源代码中只有fread, 没有fclose. 建议这里改动一下api, 直接传入 file 的 source对象, , 让调用这个api的逻辑 自己去处理 fopen 和fclose... \r\n\r\npublic function uploadFile($key, $file)\r\n  {\r\n    $file_content =  fopen($file, 'rb');\r\n    $result = $this->ossClient->putObject(array(\r\n        'Bucket' => $this->bucket,\r\n        'Key' => $key,\r\n        'Content' =>$file_content,\r\n        'ContentLength' => filesize($file)\r\n    ));\r\n\r\n    fclose($file_content);\r\n    \r\n    return $result;\r\n\r\n  }"},"comment":{"url":"https://api.github.com/repos/johnlui/AliyunOSS/issues/comments/128731575","html_url":"https://github.com/johnlui/AliyunOSS/issues/3#issuecomment-128731575","issue_url":"https://api.github.com/repos/johnlui/AliyunOSS/issues/3","id":128731575,"user":{"login":"johnlui","id":2127912,"avatar_url":"https://avatars.githubusercontent.com/u/2127912?v=3","gravatar_id":"","url":"https://api.github.com/users/johnlui","html_url":"https://github.com/johnlui","followers_url":"https://api.github.com/users/johnlui/followers","following_url":"https://api.github.com/users/johnlui/following{/other_user}","gists_url":"https://api.github.com/users/johnlui/gists{/gist_id}","starred_url":"https://api.github.com/users/johnlui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnlui/subscriptions","organizations_url":"https://api.github.com/users/johnlui/orgs","repos_url":"https://api.github.com/users/johnlui/repos","events_url":"https://api.github.com/users/johnlui/events{/privacy}","received_events_url":"https://api.github.com/users/johnlui/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T15:23:16Z","updated_at":"2015-08-07T15:23:16Z","body":"Done!"}}