[racket] "upload file" button in a Racket web server

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Aug 1 10:24:55 EDT 2014

There's nothing that a normal Web app can do that Racket can't.
Whatever you see in the UI is just HTML + JS. The exact same HTML and
JS will work in Racket as well. The actual upload code is something

<form action="upload.cgi" enctype="multipart/form-data" method="post">
<input type="file" name="datafile" size="40">
<input type="submit" value="Send">

And on the server you will get a binding:file object:


The drag&drop into the box sounds to me like it is just done by your
browser when you use a "file" input, as above.


On Fri, Aug 1, 2014 at 9:35 AM, Andrew Dudash <drewdudash at gmail.com> wrote:
> There's the following.
>   #lang web-server/insta
>   (require web-server/formlets)
>   (define (start req)
>     (send/formlet (file-upload)))
> But this doesn't support dragging and dropping images. You can add support
> for that with JavaScript, but I don't think there's anything like it in a
> Racket library. (I'd love to be proven wrong if anyone knows of one.)
> On Thu, Jul 31, 2014 at 10:21 PM, Mitchell Wand <wand at ccs.neu.edu> wrote:
>> Many web pages have an "upload file" button that allows the user to
>> drag&drop a file onto the button, and then hitting the button sends the file
>> to the server.
>> Is there any way of doing this in a Racket web server?  If not, how close
>> can we come?
>> --Mitch
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Jay McCarthy

           "Wherefore, be not weary in well-doing,
      for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
                          - D&C 64:33

Posted on the users mailing list.