Shop OBEX P1 Docs P2 Docs Learn Events
Help with a (probably) simple HTML question from someone knowledgeable... — Parallax Forums

Help with a (probably) simple HTML question from someone knowledgeable...

agsags Posts: 386
edited 2011-02-15 22:04 in Accessories
I'm not an HTTP or HTML expert - but I seem to be impersonating one lately with my Spinneret project(s).

I have a small server up and functioning for my purposes, including a bootloader. It's still rough, though, and I have to "push" binary images to the server using Curl (see curl.haxx.se). This sends an HTTP "PUT" request, waits for a "100 Continue" response, then sends the binary image. That's fine - but it's cumbersome and clumsy. I have read the RFC and other specs (not in its entirety) and have searched for info on using HTML FORMs.

Isn't there an easy way to use FORMs on the page the Spinneret is serving, allowing the user to enter a filename and then click on a "Download" button? This would then ideally send a response to the PC/host, which would then send the file (if it exists on the PC/host) in the same way as curl, with a PUT response, wait for a 100 Continue, then send the packets. This way curl is not needed, it's all initiated from the Prop/Spinneret web page, and it is much neater.

Can anyone help with creating this HTML FORM (or some other way)?

Thanks.

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2011-02-15 16:20
    Something like in this example?

    http://24.253.241.231:3456/
  • Mike GMike G Posts: 2,702
    edited 2011-02-15 17:21
    Just do a google search for "http file upload". You'll find examples that look like
    <form action=/somecode.xxx method=post enctype=multipart/form-data>
      <input type="file">
    </form>
    


    The browser renders the html controls (See Beau's example). You just browse to the file and click a submit button. You'll see the the file content in the body of the post request on the server side. The browser does not wait for a "100 continue" though.
  • agsags Posts: 386
    edited 2011-02-15 20:15
    Something like in this example?

    http://24.253.241.231:3456/

    Yes, that is exactly the UI that I'm looking for. That's very user-friendly. Is the code available, if not for re-use at least as a tutorial/example?

    I did search and found some references to multipart/form-data stuff, but it looked like a lot of messy parsing - and I'm trying to minimize the memory footprint on the Prop/Spinneret.
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2011-02-15 22:04
    ags,

    Sure, here is the code... Most of the DEMO code is proof of concept getting key building blocks marked off.
Sign In or Register to comment.