Skip to content
Browse files

fixed file attachment

  • Loading branch information...
1 parent 345adfc commit f9190377193ecec36b2e8940517cd5b69fe13fbc @aderyabin aderyabin committed Nov 10, 2011
Showing with 1 addition and 2 deletions.
  1. +1 −2 lib/zendesk/attachment.rb
View
3 lib/zendesk/attachment.rb
@@ -2,11 +2,10 @@ class Zendesk::Attachment < Zendesk::Resource
def initialize(path, filename = nil)
@path = path
@filename = filename || File.basename(path)
-
end
# return token of attached file
def save
- response = Zendesk.resource["uploads.xml?filename=#{@filename}"].post(File.read(@path))
+ response = Zendesk.resource["uploads.xml?filename=#{@filename}"].post({:file =>File.new(@path), :multipart => true})
REXML::Document.new(response).elements['uploads'].attributes['token']
end

0 comments on commit f919037

Please sign in to comment.
Something went wrong with that request. Please try again.