<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.method.me/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Method:API Q&amp;A</title><link>http://forums.method.me/cs/forums/15.aspx</link><description>Ask questions specific to the MethodAPI from the Method Team and other Method users.</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 SP2 (Build: 31113.47)</generator><item><title>Re: Update File API Call convert Image to byte array.</title><link>http://forums.method.me/cs/forums/thread/35378.aspx</link><pubDate>Tue, 18 Jul 2017 23:21:25 GMT</pubDate><guid isPermaLink="false">3393c1ec-311b-4812-96cb-ad8c611bba4f:35378</guid><dc:creator>dknoben</dc:creator><slash:comments>0</slash:comments><comments>http://forums.method.me/cs/forums/thread/35378.aspx</comments><wfw:commentRss>http://forums.method.me/cs/forums/commentrss.aspx?SectionID=15&amp;PostID=35378</wfw:commentRss><description>&lt;p style="margin-bottom:0in;font-style:normal;font-weight:normal;line-height:0.21in;orphans:1;"&gt;&lt;span style="overflow:hidden;"&gt;&lt;span id="mce_2_start" style="overflow:hidden;"&gt;&lt;/span&gt;&lt;span style="overflow:hidden;"&gt;&lt;/span&gt;&lt;/span&gt;T&lt;span style="color:#333333;"&gt;&lt;span style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;"&gt;&lt;span style="font-size:small;"&gt;&lt;span id="mce_3_start" style="overflow:hidden;"&gt;&lt;/span&gt;he solution for this ended up being fairly simple. The image data can be fetched using this basic pattern:&lt;br /&gt;$handle = fopen($imageUrl, &amp;#39;rb&amp;#39;);&lt;br /&gt;$imageData = stream_get_contents($handle);&lt;br /&gt;At this point, $imageData can be passed to Method using the MethodAPIUpdateFile SOAP call. However, we ran into a couple of issue which are probably worth noting:&lt;br /&gt;1) The MethodAPIUpdateFile expects a strFileName parameter which isn&amp;#39;t mentioned in the API documentation.&lt;br /&gt;2) After some unsuccessful attempts to update a file with improperly formatted data, all subsequent MethodAPIUpdateFile calls which used the same strFileName value failed to update the file with properly formatted data, despite a success response from the SOAP service. Seems like a potential bug with the API, which we circumvented by updating strFileName to a unique value.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Tahoma;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id="mce_0_start" style="overflow:hidden;"&gt;&lt;span id="mce_2_start" style="overflow:hidden;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Re: Update File API Call convert Image to byte array.</title><link>http://forums.method.me/cs/forums/thread/35376.aspx</link><pubDate>Tue, 18 Jul 2017 17:25:53 GMT</pubDate><guid isPermaLink="false">3393c1ec-311b-4812-96cb-ad8c611bba4f:35376</guid><dc:creator>Matt</dc:creator><slash:comments>0</slash:comments><comments>http://forums.method.me/cs/forums/thread/35376.aspx</comments><wfw:commentRss>http://forums.method.me/cs/forums/commentrss.aspx?SectionID=15&amp;PostID=35376</wfw:commentRss><description>&lt;p&gt;&lt;span id="mce_0_start" style="overflow:hidden;"&gt;I&amp;#39;ve done it in C#, but not php.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id="mce_0_start" style="overflow:hidden;"&gt;&lt;/span&gt;The first thing to do is remove &amp;quot;&lt;span id="mce_1_start" style="overflow:hidden;"&gt;data:image/jpeg;base64,&amp;quot; from the image string.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="overflow:hidden;"&gt;Then convert it to a byte array. In C# this looks like :&lt;span id="mce_2_start" style="overflow:hidden;"&gt;&amp;nbsp;byte[ uploadedImage = Convert.FromBase64String(&lt;span id="mce_3_start" style="overflow:hidden;"&gt;imageString&lt;/span&gt;);&lt;span id="mce_4_start" style="overflow:hidden;"&gt; I would assume PHP has a similar funtion.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Update File API Call convert Image to byte array.</title><link>http://forums.method.me/cs/forums/thread/35375.aspx</link><pubDate>Mon, 17 Jul 2017 22:39:45 GMT</pubDate><guid isPermaLink="false">3393c1ec-311b-4812-96cb-ad8c611bba4f:35375</guid><dc:creator>dknoben</dc:creator><slash:comments>0</slash:comments><comments>http://forums.method.me/cs/forums/thread/35375.aspx</comments><wfw:commentRss>http://forums.method.me/cs/forums/commentrss.aspx?SectionID=15&amp;PostID=35375</wfw:commentRss><description>&lt;p&gt;&lt;span id="mce_0_start" style="overflow:hidden;"&gt;&lt;span id="mce_1_start" style="overflow:hidden;"&gt;Has anyone had to make a byte array out of an image url so they can upload it to method using the UpdateFile Call in PHP.&amp;nbsp; I am running into issues creating the image byte array and was hoping someone else migh have already solved this issue. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item></channel></rss>