Hi, JSON (require json-parsing) see https://docs.racket-lang.org/json-parsing/index.html
I've cribbed the HTML below from http://www.w3schools.com/tags/att_input_accept.asp On the web server side this SO response seems to answer, http://stackoverflow.com/questions/20588641/in-racket-how-do-you-allow-file-upload-to-the-web-server #lang web-server/insta (require web-server/formlets) ; start: request -> doesn't return (define (start request) (show-page request)) ; show-page: request -> doesn't return (define (show-page request) ; Response generator (define (response-generator embed/url) (response/xexpr `(html (head (title "File upload example")) (body (h1 "File upload example")) (form ([action ,(embed/url upload-handler)] [method "POST"] [enctype "multipart/form-data"]) ,@(formlet-display file-upload-formlet) (input ([type "submit"] [value "Upload"])))))) (define (upload-handler request) (define-values (fname fcontents) (formlet-process file-upload-formlet request)) (define save-name (string-append "!uploaded-" fname)) (current-directory WORKINGDIR) (display-to-file fcontents save-name #:exists 'replace) (response/xexpr `(html (head (title "File Uploaded")) (body (h2 "File uploaded") (p ,fname) (h2 "File size (bytes)") (p ,(number->string (file-size save-name))))))) (send/suspend/dispatch response-generator)) ; file-upload-formlet: formlet (binding?) (define file-upload-formlet (formlet (div ,{(file-upload) . => . binds}) ; (formlet-process file-upload-formlet request) ; returns the file name and contents: (let ([fname (bytes->string/utf-8 (binding:file-filename binds))] [fcontents (binding:file-content binds)]) (values fname fcontents)))) (I've not tried this - I'm not sure it is correct) <!DOCTYPE html> <html> <body> <form action="demo_form.rkt"> <input type="file" name="pic" accept="application/json"> <input type="submit"> </form> <p><strong>Note:</strong> The accept attribute of the input tag is not supported in Internet Explorer 9 (and earlier versions), and Safari 5 (and earlier).</p> <p><strong>Note:</strong> Because of security issues, this example will not allow you to upload files.</p> </body> </html> HTH Stephen On Tuesday, August 23, 2016 at 3:47:05 PM UTC+1, Normal Loone wrote: > No, I don't have it in JSON yet. How do I load a file into JSON in racket? > > It's only a text file, although I like to get it zipped first. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.