<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Send binary files via cl_http_client in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-binary-files-via-cl-http-client/m-p/4111793#M983093</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found the solution myself:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  part = client-&amp;gt;request-&amp;gt;add_multipart( ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD part-&amp;gt;set_header_field&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      name  = 'content-disposition'&lt;/P&gt;&lt;P&gt;      value = 'form-data;name="file"; filename="file.bin";'.&lt;/P&gt;&lt;P&gt;  CALL METHOD part-&amp;gt;set_header_field&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      name  = 'content-type'&lt;/P&gt;&lt;P&gt;       value = 'bin'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET '/file.bin FOR INPUT IN BINARY MODE.&lt;/P&gt;&lt;P&gt;read dataset '/file.bin' into data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;len = xstrlen( data ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD part-&amp;gt;set_data&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      data = data&lt;/P&gt;&lt;P&gt;      offset = 0&lt;/P&gt;&lt;P&gt;      length = len.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Jul 2008 09:00:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-07T09:00:41Z</dc:date>
    <item>
      <title>Send binary files via cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-binary-files-via-cl-http-client/m-p/4111792#M983092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to send a binary file to a http form via cl_http_client. &lt;/P&gt;&lt;P&gt;The webserver is awaiting the binary data with the name 'file'. &lt;/P&gt;&lt;P&gt;My problem is, that I don't know how I can set the name for the binary data.&lt;/P&gt;&lt;P&gt;When I send the data via:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD client-&amp;gt;request-&amp;gt;if_http_entity~set_form_field&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      name  = 'file'&lt;/P&gt;&lt;P&gt;      value = binary_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the webserver interprets this as a string and not as a file. &lt;/P&gt;&lt;P&gt;How can I send the data as a file and the name 'file'?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 06:27:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-binary-files-via-cl-http-client/m-p/4111792#M983092</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T06:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Send binary files via cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-binary-files-via-cl-http-client/m-p/4111793#M983093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found the solution myself:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  part = client-&amp;gt;request-&amp;gt;add_multipart( ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD part-&amp;gt;set_header_field&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      name  = 'content-disposition'&lt;/P&gt;&lt;P&gt;      value = 'form-data;name="file"; filename="file.bin";'.&lt;/P&gt;&lt;P&gt;  CALL METHOD part-&amp;gt;set_header_field&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      name  = 'content-type'&lt;/P&gt;&lt;P&gt;       value = 'bin'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET '/file.bin FOR INPUT IN BINARY MODE.&lt;/P&gt;&lt;P&gt;read dataset '/file.bin' into data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;len = xstrlen( data ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD part-&amp;gt;set_data&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      data = data&lt;/P&gt;&lt;P&gt;      offset = 0&lt;/P&gt;&lt;P&gt;      length = len.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 09:00:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-binary-files-via-cl-http-client/m-p/4111793#M983093</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T09:00:41Z</dc:date>
    </item>
  </channel>
</rss>

