[racket-users] Re: Sending a file via HTML request.

2016-08-26 Thread George Neuner
On Tue, 23 Aug 2016 02:09:24 -0700 (PDT), Normal Loone wrote: >Yeah, my main problem is how do I pack the file into a JSON Object >and then send it? Just FYI: JSON is a printable coding, so any non-printable characters in a binary file must be escaped - making the transfer larger. The read-json

Re: [racket-users] Re: Sending a file via HTML request.

2016-08-24 Thread George Neuner
I posted to this thread yesterday through Gmane, but I see it hasn't yet appeared. Posting through Gmane has been flaky lately - I'm sending this updated version via email.Not sure what's happening with Gmane. Apologies if you see things multiple times. George

Re: [racket-users] Re: Sending a file via HTML request.

2016-08-24 Thread Stephen Chang
Vishesh Yadav wrote a DrRacket plugin that automatically compiles a program to JS via whalesong and uploads it to a server. It sounds related to what you are describing so you may want to take a look at his code. The plugin code is here: https://github.com/vishesh/drracket-whalesong in particular

[racket-users] Re: Sending a file via HTML request.

2016-08-24 Thread Normal Loone
Sorry, I should have been clearer: I want to send a file directly from DrRacket to a server. I have submit button as a plugin in DrRacket and it then should take the file and send it to the server (the file is known, doesnt need to be selected from user). I tried the code from HTH Stephen, but

[racket-users] Re: Sending a file via HTML request.

2016-08-23 Thread Jack Firth
You could base64 encode the file bytes and stick that into a field in the JSON you send. Why not just send the file directly though? For instance, instead of sending this: POST /somewhere Content-Type: application/json { filename: "foo" content: "Zm9vLGJhcixiYXoNCjEsMSwxDQoyLDIsMg0KMywzLDM="