Skip to content

Commit

Permalink
Use an IO as input file or open it if it is a path
Browse files Browse the repository at this point in the history
  • Loading branch information
hanklords committed Dec 15, 2012
1 parent 7d121f4 commit b13ad4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/flickraw/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ def process_response(req, response)

def upload_flickr(method, file, args={})
args = build_args(args)
args['photo'] = open(file, 'rb')
if file.respond_to? :read
args['photo'] = file
else
args['photo'] = open(file, 'rb')
end

http_response = @oauth_consumer.post_multipart(method, @access_secret, {:oauth_token => @access_token}, args)
process_response(method, http_response.body)
Expand Down

0 comments on commit b13ad4d

Please sign in to comment.