Can't Upload Attachment with REPLY

Developer Space

Developer Space
Want to extend the Telligent Evolution platform? Collaborate with other developers and product experts here.

Can't Upload Attachment with REPLY

This question has suggested answer(s)

The REPLY call succeeds, and the attachment is recognized by the server, but not stored/downloaded.  Can you help provide the magic to upload a attachment with the parameters below?  Thanks! 

HTTP URL:    https://www.cirruspilots.org/api.ashx/v2/forums/threads/138332/replies.json

HTTP Method: POST

HTTP Header: {

    "Content-Type" = "application/x-www-form-urlencoded";

    "Rest-User-Token" = "token-removed-for-privacy";

}

The body includes...

FileData=Base64 representation of PNG File

FileName=i.png

ContentType=image/png

What am I missing to upload a PNG attachment?

All Replies
  • When I retrieve this post, I get the following JSON.  This suggests that the server was able to upload the data - because it correctly figured out the file size.  Not sure why this image doesn't display at all.  I'm encoding the image as Base64 on upload, is this correct?

               File =             {

                   ContentType = "image/png";

                   Date = "2013-12-24T12:07:01.957";

                   FileName = "i.png";

                   FileSize = 32560;

                   FileUrl = "www.cirruspilots.org/.../i.png";

                   IsRemoteAttachment = 0;

               };

  • I can upload text files via the REST API, but still can not use the REST API to upload a PNG.  Is it possible to provide a complete example?  Thanks in advance.  

  • Here's a link to the documentation that should help: telligent.com/.../36679.how-to-upload-a-file-filedata.aspx

    The file data is not base64 encoded (which is likely why text files work and binary files don't).  You'll need to post a multipart form request as in the example to send a binary file.

  • After multiple hours of trying every combination I could think of, I still can't upload an image.  Here's my HTTP Header/URL/Method/Body that I use for a successful text upload.  Can you change the appraise lines for uploading an image?  Thanks so much...

    URL:     www.cirruspilots.org/.../replies.json

    Method:  POST

    Headers: {

       "Content-Type" = "multipart/form-data; boundary=---------------------------14737809831466499882746641449";

       "Rest-User-Token" = "c25l  ..... ..... ..... ....  5kZXI=";

    }

    -----------------------------14737809831466499882746641449

    Content-Disposition: form-data; name="ParentReplyId"

    0

    -----------------------------14737809831466499882746641449

    Content-Disposition: form-data; name="Body"

    15<br><br><span style="font-size:smaller;">via <a href="itunes.apple.com/.../id325439353 target="new">iCopa</a></span>

    -----------------------------14737809831466499882746641449

    Content-Disposition: form-data; name="Subject"

    -----------------------------14737809831466499882746641449

    Content-Disposition: form-data; name="ContentType"

    text/plain

    -----------------------------14737809831466499882746641449

    Content-Disposition: form-data; name="FileName"

    textFile.txt

    -----------------------------14737809831466499882746641449

    Content-Disposition: form-data; name="FileData"

    Text File Contents

    -----------------------------14737809831466499882746641449