HttpRequest:Content and binary data

This forum is for conversations about Internet development using CXP, WebSockets, HttpEndPoint, etc.
Post Reply
Message
Author
Sbryan
Posts: 28
Joined: Sun Oct 18, 2015 7:15 am

HttpRequest:Content and binary data

#1 Post by Sbryan »

Part of my application allows the upload of images to the server using a multi-part form and I'm using Chilkat's Mime functions to save the images but I've run into a problem. I've been working with Matt Fausey of Chilkat trying to figure it out and he said it looks like HttpRequest:Content is converting the binary data of the mime message to utf-16 which is causing the issue.

Since the documentation is still pretty sparse even after all these years, I've been unable to find out much about it and was wondering if there is a way to prevent it from converting the image data. Or, is there a way with the Foundation version of CXP to save the files directly?

Sbryan
Posts: 28
Joined: Sun Oct 18, 2015 7:15 am

Re: HttpRequest:Content and binary data

#2 Post by Sbryan »

After some searching I realized there is a sample for saving files in the cxp web samples which I was able to use and can get it save files based on the settings in global.config.
My question now is, How do I properly save the file from the oHttpUploadedFile:Data if I want to?

User avatar
Tom
Posts: 885
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: HttpRequest:Content and binary data

#3 Post by Tom »

We use Base64-encoding for any kind of binary data transported from or to our servers.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Sbryan
Posts: 28
Joined: Sun Oct 18, 2015 7:15 am

Re: HttpRequest:Content and binary data

#4 Post by Sbryan »

Thanks Tom,

I understand the need for converting binary data to base64 for transporting but I'm a little confused how to convert it in the client browser before sending to the server. I was under the impression (obviously wrong) that modern browsers automatically encoded data during a POST.

Post Reply