How can I upload a file using Catalyst?

I am working on an internal web based application for storing and cataloging photos. How should I retrieve, and save these files to the server?

Note: I want to save the files to the file system, not to a database. Similar to How can I handle HTTP file uploads?


Start with your familiar upload INPUT on your HTML form and ensure that the HTML form tag has the parameter enctype="multipart/form-data"

Your Catalyst::Request object ($c->request) provides two methods for accessing and manipulating the files.

Each file upload field will be instantiated as a Catalyst::Request::Upload object.

$c->request->upload will return the Upload objects in scalar or list form. $c->request->uploads will return a reference to hash of Upload objects.

The Upload object provides several method for saving and copying the files.

Check out the man pages that I've linked above.

Need Your Help

Emacs: Rinari. How to make haml files also open in rinari-minor-mode

ruby-on-rails ruby emacs haml rinari

When using rinari, rinari-minor-mode is enabled when editing any .rb file. Though, when opening .haml files rinari-minor-mode is disabled.

Controlling android sound settings


I'm developing an android application that helps manage notification sound settings. It should allow people to set a "quiet time" when the phone will go into silent mode automatically, and so on. I...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.