title: How to create a product image on Magento Api using Ruby
body: <p>I am try to upload a image on magento API using Ruby.</p>
  
  <p>This is my code:</p>
  
  <pre><code>require 'rubygems'
  require 'soap/wsdlDriver'
  require 'base64'
  
  WSDL_URL = 'http://teeshop.chandru/api/v2_soap/?wsdl=1'
  
  soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
  
  session = soap.login('*********','*********')
  
  
  a = File.read('image/CP0760-01.jpg')
  enc = Base64.encode64(a)
  
  create_image = { 'file' =&gt; {"name" =&gt; "CP0760-01.jpg", "content" =&gt; enc,"mime" =&gt; 'image/jpeg'}, "label" =&gt; "kids cloths","position" =&gt; 0, "types" =&gt; ["image,""small_image", "thumbnail" ], "exclude" =&gt; 0 }
  
  product_image = soap.call('catalogProductAttributeMediaCreate',session,'CP0760 (P.34)',creeate_image,1,'sku')
  </code></pre>
  
  <p>When I run this code I got this error:</p>
  
  <blockquote>
    <p>The image contents is not valid base64 data. (SOAP::FaultError)</p>
  </blockquote>
  
  <p>Is there any solution for my problem?</p>
  
  <p>Thanks</p>