[Jifty-commit] r7349 - jifty/trunk/lib/Jifty/Manual

Jifty commits jifty-commit at lists.jifty.org
Fri Jul 31 23:30:39 EDT 2009


Author: c9s
Date: Fri Jul 31 23:30:37 2009
New Revision: 7349

Modified:
   jifty/trunk/lib/Jifty/Manual/Cookbook.pod

Log:
add file upload code snippet to manual/cookbook

Modified: jifty/trunk/lib/Jifty/Manual/Cookbook.pod
==============================================================================
--- jifty/trunk/lib/Jifty/Manual/Cookbook.pod	(original)
+++ jifty/trunk/lib/Jifty/Manual/Cookbook.pod	Fri Jul 31 23:30:37 2009
@@ -11,6 +11,30 @@
 
 =head1 HOW DO I ...
 
+=head2 Upload file via Action parameter
+
+In your action schema:
+
+    use Jifty::Action schema {
+
+        param image =>
+            type is 'upload'
+            label is _('Upload a file');
+
+    };
+
+to catch the file , in your C<take_action> method:
+
+    sub take_action {
+        my $self = shift;
+
+        my $fh = $self->argument_value('image');
+        local $/;
+        my $file_content = <$fh>
+        close $fh;
+
+    }
+
 =head2 Use PostgreSQL insteads of default SQLite database.
 
 You need to modify your F<etc/config.yml> file.


More information about the Jifty-commit mailing list