[dancer-users] Upload form tutorial

Warren Young warren at etr-usa.com
Wed Sep 3 00:08:20 BST 2014


On 9/2/2014 15:13, Alex wrote:
> This is possible with Dancer?

Yes.  We've been doing this for many years now, first with Apache::ASP, 
and now with Dancer 1.  As the linked-to page says, you only need a 
server-side platform that understands HTML form file uploads.

To do this really right, you need a browser that understands the HTML5 
File API, but that's pretty much every browser going back many years, 
except for IE, where it didn't appear until IE10:

     http://caniuse.com/#feat=fileapi

I can't share the JS or Dancer code, since it's part of a proprietary 
app, but I can assure you that the tutorials you'll find for the popular 
server-side web frameworks translate easily to Dancer.  There isn't any 
trickery involved.  Just translate the PHP or whatever code you've dug 
up in the way that seems most obvious, and it's probably correct.

The end result is much better than the old "submit single huge blob to 
multipart HTML form" way of doing file uploads, particularly for large 
files and/or slow networks.

Anyone trying this and failing should make use of Cunningham's Law: The 
fastest way to get the right answer on the Internet is to post the wrong 
answer.  That is, post your broken code and I or someone else will 
quickly tell you where you screwed up. :)

Asking strangers to provide a ready to use example is less effective.


More information about the dancer-users mailing list