{"action":"closed","number":20,"pull_request":{"url":"https://api.github.com/repos/alex-phillips/clouddrive-php/pulls/20","id":57098119,"html_url":"https://github.com/alex-phillips/clouddrive-php/pull/20","diff_url":"https://github.com/alex-phillips/clouddrive-php/pull/20.diff","patch_url":"https://github.com/alex-phillips/clouddrive-php/pull/20.patch","issue_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/issues/20","number":20,"state":"closed","locked":false,"title":"Converted uploadFile to stream the contents, accept resource or string","user":{"login":"Zn4rK","id":873043,"avatar_url":"https://avatars.githubusercontent.com/u/873043?v=3","gravatar_id":"","url":"https://api.github.com/users/Zn4rK","html_url":"https://github.com/Zn4rK","followers_url":"https://api.github.com/users/Zn4rK/followers","following_url":"https://api.github.com/users/Zn4rK/following{/other_user}","gists_url":"https://api.github.com/users/Zn4rK/gists{/gist_id}","starred_url":"https://api.github.com/users/Zn4rK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zn4rK/subscriptions","organizations_url":"https://api.github.com/users/Zn4rK/orgs","repos_url":"https://api.github.com/users/Zn4rK/repos","events_url":"https://api.github.com/users/Zn4rK/events{/privacy}","received_events_url":"https://api.github.com/users/Zn4rK/received_events","type":"User","site_admin":false},"body":"I ran into an issue saying \"400 Bad Request\" with no message, when trying to upload .cr2-raw files. Renaming them to .jpg worked.\r\n\r\nAfter a whole lot of debugging and research, I found a thread on Amazon's forum, specificing how the multipart should look;\r\nhttps://forums.developer.amazon.com/forums/thread.jspa?messageID=21591&#21591\r\n\r\nSo this PR covers that. \r\n\r\nDuring this, I also converted uploadFile to take either a resource or a path, and I'm using  stream_get_meta_data to get the path of the stream if it's a stream. I'm also creating the stream early on, since it's being converted on at least two places (Node::overwrite() and CloudDrive->nodeExists()) to streams anyway. \r\n\r\nThis means that the recent, accepted PR of the streams-branch is kinda obsolete, but I kept the uploadStream()-method in, but converted it to just call uploadFile, so we have nice backwards compatibility.","created_at":"2016-01-25T16:54:59Z","updated_at":"2016-01-25T18:30:12Z","closed_at":"2016-01-25T18:30:11Z","merged_at":null,"merge_commit_sha":"7fb9db0eb8909e308d0cb0f4625727e7197ce9ae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/pulls/20/commits","review_comments_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/pulls/20/comments","review_comment_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/issues/20/comments","statuses_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/statuses/9a31054090e7b8a64d39134da22a424a5490dede","head":{"label":"Zn4rK:master","ref":"master","sha":"9a31054090e7b8a64d39134da22a424a5490dede","user":{"login":"Zn4rK","id":873043,"avatar_url":"https://avatars.githubusercontent.com/u/873043?v=3","gravatar_id":"","url":"https://api.github.com/users/Zn4rK","html_url":"https://github.com/Zn4rK","followers_url":"https://api.github.com/users/Zn4rK/followers","following_url":"https://api.github.com/users/Zn4rK/following{/other_user}","gists_url":"https://api.github.com/users/Zn4rK/gists{/gist_id}","starred_url":"https://api.github.com/users/Zn4rK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zn4rK/subscriptions","organizations_url":"https://api.github.com/users/Zn4rK/orgs","repos_url":"https://api.github.com/users/Zn4rK/repos","events_url":"https://api.github.com/users/Zn4rK/events{/privacy}","received_events_url":"https://api.github.com/users/Zn4rK/received_events","type":"User","site_admin":false},"repo":{"id":50364759,"name":"clouddrive-php","full_name":"Zn4rK/clouddrive-php","owner":{"login":"Zn4rK","id":873043,"avatar_url":"https://avatars.githubusercontent.com/u/873043?v=3","gravatar_id":"","url":"https://api.github.com/users/Zn4rK","html_url":"https://github.com/Zn4rK","followers_url":"https://api.github.com/users/Zn4rK/followers","following_url":"https://api.github.com/users/Zn4rK/following{/other_user}","gists_url":"https://api.github.com/users/Zn4rK/gists{/gist_id}","starred_url":"https://api.github.com/users/Zn4rK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zn4rK/subscriptions","organizations_url":"https://api.github.com/users/Zn4rK/orgs","repos_url":"https://api.github.com/users/Zn4rK/repos","events_url":"https://api.github.com/users/Zn4rK/events{/privacy}","received_events_url":"https://api.github.com/users/Zn4rK/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Zn4rK/clouddrive-php","description":"Amazon Cloud Drive API and CLI for PHP","fork":true,"url":"https://api.github.com/repos/Zn4rK/clouddrive-php","forks_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/forks","keys_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/teams","hooks_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/hooks","issue_events_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/issues/events{/number}","events_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/events","assignees_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/assignees{/user}","branches_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/branches{/branch}","tags_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/tags","blobs_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/statuses/{sha}","languages_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/languages","stargazers_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/stargazers","contributors_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/contributors","subscribers_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/subscribers","subscription_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/subscription","commits_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/issues/comments{/number}","contents_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/contents/{+path}","compare_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/merges","archive_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/downloads","issues_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/issues{/number}","pulls_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/pulls{/number}","milestones_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/milestones{/number}","notifications_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/labels{/name}","releases_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/releases{/id}","deployments_url":"https://api.github.com/repos/Zn4rK/clouddrive-php/deployments","created_at":"2016-01-25T16:39:24Z","updated_at":"2016-01-25T16:39:25Z","pushed_at":"2016-01-25T18:30:11Z","git_url":"git://github.com/Zn4rK/clouddrive-php.git","ssh_url":"git@github.com:Zn4rK/clouddrive-php.git","clone_url":"https://github.com/Zn4rK/clouddrive-php.git","svn_url":"https://github.com/Zn4rK/clouddrive-php","homepage":"","size":153,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"alex-phillips:master","ref":"master","sha":"9a31054090e7b8a64d39134da22a424a5490dede","user":{"login":"alex-phillips","id":3135216,"avatar_url":"https://avatars.githubusercontent.com/u/3135216?v=3","gravatar_id":"","url":"https://api.github.com/users/alex-phillips","html_url":"https://github.com/alex-phillips","followers_url":"https://api.github.com/users/alex-phillips/followers","following_url":"https://api.github.com/users/alex-phillips/following{/other_user}","gists_url":"https://api.github.com/users/alex-phillips/gists{/gist_id}","starred_url":"https://api.github.com/users/alex-phillips/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex-phillips/subscriptions","organizations_url":"https://api.github.com/users/alex-phillips/orgs","repos_url":"https://api.github.com/users/alex-phillips/repos","events_url":"https://api.github.com/users/alex-phillips/events{/privacy}","received_events_url":"https://api.github.com/users/alex-phillips/received_events","type":"User","site_admin":false},"repo":{"id":33751350,"name":"clouddrive-php","full_name":"alex-phillips/clouddrive-php","owner":{"login":"alex-phillips","id":3135216,"avatar_url":"https://avatars.githubusercontent.com/u/3135216?v=3","gravatar_id":"","url":"https://api.github.com/users/alex-phillips","html_url":"https://github.com/alex-phillips","followers_url":"https://api.github.com/users/alex-phillips/followers","following_url":"https://api.github.com/users/alex-phillips/following{/other_user}","gists_url":"https://api.github.com/users/alex-phillips/gists{/gist_id}","starred_url":"https://api.github.com/users/alex-phillips/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex-phillips/subscriptions","organizations_url":"https://api.github.com/users/alex-phillips/orgs","repos_url":"https://api.github.com/users/alex-phillips/repos","events_url":"https://api.github.com/users/alex-phillips/events{/privacy}","received_events_url":"https://api.github.com/users/alex-phillips/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alex-phillips/clouddrive-php","description":"Amazon Cloud Drive API and CLI for PHP","fork":false,"url":"https://api.github.com/repos/alex-phillips/clouddrive-php","forks_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/forks","keys_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/teams","hooks_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/hooks","issue_events_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/issues/events{/number}","events_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/events","assignees_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/assignees{/user}","branches_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/branches{/branch}","tags_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/tags","blobs_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/statuses/{sha}","languages_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/languages","stargazers_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/stargazers","contributors_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/contributors","subscribers_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/subscribers","subscription_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/subscription","commits_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/issues/comments{/number}","contents_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/contents/{+path}","compare_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/merges","archive_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/downloads","issues_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/issues{/number}","pulls_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/pulls{/number}","milestones_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/milestones{/number}","notifications_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/labels{/name}","releases_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/releases{/id}","deployments_url":"https://api.github.com/repos/alex-phillips/clouddrive-php/deployments","created_at":"2015-04-10T21:22:18Z","updated_at":"2016-01-20T18:29:58Z","pushed_at":"2016-01-25T16:55:00Z","git_url":"git://github.com/alex-phillips/clouddrive-php.git","ssh_url":"git@github.com:alex-phillips/clouddrive-php.git","clone_url":"https://github.com/alex-phillips/clouddrive-php.git","svn_url":"https://github.com/alex-phillips/clouddrive-php","homepage":"","size":159,"stargazers_count":13,"watchers_count":13,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alex-phillips/clouddrive-php/pulls/20"},"html":{"href":"https://github.com/alex-phillips/clouddrive-php/pull/20"},"issue":{"href":"https://api.github.com/repos/alex-phillips/clouddrive-php/issues/20"},"comments":{"href":"https://api.github.com/repos/alex-phillips/clouddrive-php/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/alex-phillips/clouddrive-php/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/alex-phillips/clouddrive-php/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alex-phillips/clouddrive-php/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/alex-phillips/clouddrive-php/statuses/9a31054090e7b8a64d39134da22a424a5490dede"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":0,"additions":0,"deletions":0,"changed_files":0}}