Dear all, is there a tutorial how to create a Perl upload form with Dancer? Something basic and simple like this but without CGI? -> http://www.perlmeme.org/tutorials/cgi_upload.html Because, when I was a real noob, I learned Perl from scripts like these. And I still enjoy learning new things this way. Regards, Alex
Not quite a tutorial, but the docs for Dancer::Request::Upload <https://metacpan.org/pod/Dancer::Request::Upload#SYNOPSIS> contain a good, simple example: # somewhere in your view: <form action="/upload" method="POST" enctype="multipart/form-data"> <input type="file" name="filename"> <input type="submit"> </form> # and then in your application handler: post '/upload' => sub { my $file = request->upload('filename'); $file->copy_to($upload_dir); # or whatever you need }; On Tue, Sep 2, 2014 at 1:53 PM, Alex Becker <asb.cpan@gmail.com> wrote:
Dear all,
is there a tutorial how to create a Perl upload form with Dancer? Something basic and simple like this but without CGI? -> http://www.perlmeme.org/tutorials/cgi_upload.html Because, when I was a real noob, I learned Perl from scripts like these. And I still enjoy learning new things this way.
Regards, Alex
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
More interesting is how to upload with jquery upload plugin and Dancer - http://blueimp.github.io/jQuery-File-Upload/ 03.09.2014 2:10, Maxwell Carey пишет:
Not quite a tutorial, but the docs for Dancer::Request::Upload <https://metacpan.org/pod/Dancer::Request::Upload#SYNOPSIS> contain a good, simple example: [...]
On Tue, Sep 2, 2014 at 1:53 PM, Alex Becker <asb.cpan@gmail.com <mailto:asb.cpan@gmail.com>> wrote:
Dear all,
is there a tutorial how to create a Perl upload form with Dancer? Something basic and simple like this but without CGI? -> http://www.perlmeme.org/tutorials/cgi_upload.html Because, when I was a real noob, I learned Perl from scripts like these. And I still enjoy learning new things this way. [...]
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130
This is possible with Dancer?
Am 02.09.2014 um 22:25 schrieb Nick Knutov <mail@knutov.com>:
More interesting is how to upload with jquery upload plugin and Dancer - http://blueimp.github.io/jQuery-File-Upload/
03.09.2014 2:10, Maxwell Carey пишет:
Not quite a tutorial, but the docs for Dancer::Request::Upload <https://metacpan.org/pod/Dancer::Request::Upload#SYNOPSIS> contain a good, simple example: [...]
On Tue, Sep 2, 2014 at 1:53 PM, Alex Becker <asb.cpan@gmail.com <mailto:asb.cpan@gmail.com>> wrote:
Dear all,
is there a tutorial how to create a Perl upload form with Dancer? Something basic and simple like this but without CGI? -> http://www.perlmeme.org/tutorials/cgi_upload.html Because, when I was a real noob, I learned Perl from scripts like these. And I still enjoy learning new things this way. [...]
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130 _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Yes I hope. But I don't know how to do it yet. 03.09.2014 3:13, Alex пишет:
This is possible with Dancer?
Am 02.09.2014 um 22:25 schrieb Nick Knutov <mail@knutov.com>:
More interesting is how to upload with jquery upload plugin and Dancer - http://blueimp.github.io/jQuery-File-Upload/
03.09.2014 2:10, Maxwell Carey пишет:
Not quite a tutorial, but the docs for Dancer::Request::Upload <https://metacpan.org/pod/Dancer::Request::Upload#SYNOPSIS> contain a good, simple example: [...]
On Tue, Sep 2, 2014 at 1:53 PM, Alex Becker <asb.cpan@gmail.com <mailto:asb.cpan@gmail.com>> wrote:
Dear all,
is there a tutorial how to create a Perl upload form with Dancer? Something basic and simple like this but without CGI? -> http://www.perlmeme.org/tutorials/cgi_upload.html Because, when I was a real noob, I learned Perl from scripts like these. And I still enjoy learning new things this way. [...]
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130 _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130
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.
participants (5)
-
Alex -
Alex Becker -
Maxwell Carey -
Nick Knutov -
Warren Young