[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SUCCESS with a binary upload!



I found the problem.

Looking at the source for the http_mfd_encoder_open() routine, I noticed that it was unconditionally setting up the correct content-type, and generating a boundary, and yet that wasn't showing up at all in the httpapi_debug file. I searched for "Content-Type," and saw something that didn't make sense, and so I went back to the EXAMPLE7 source member, and my test source member, and found the problem.

In adapting the code from EXAMPLE7, I left out some parameters on the http_url_post_stmf() call:

Instead of
C                   eval      rc = http_url_post_stmf(
c                              'https://foo/bar.com' +
c                              ':8090/rest/attachment/uploadaszip?' +
c                              'objectSchemaName=installed_products' +
c                              '&recordId=10': TEMPFILE:
c                              '/tmp/http_result.txt':
C                              HTTP_TIMEOUT:
C                              HTTP_USERAGENT:
C                              CONTENTTYPE)

I had
C                   eval      rc = http_url_post_stmf(
c                              'https://foo/bar.com' +
c                              ':8090/rest/attachment/uploadaszip?' +
c                              'objectSchemaName=installed_products' +
c                              '&recordId=10': TEMPFILE:
c                              '/tmp/http_result.txt')

which defaulted the overall content type as
Content-Type: text/xml

where it should have been
Content-Type: multipart/form-data; boundary=-httpapi-2016-10-26-10.53.35.456

Once I corrected that oversight, the zip file upload worked perfectly (regardless of whether the individual part's content-type was specified as "application/octet-stream" or "multipart/form-data").

--
JHHL
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------