<?xml version="1.0" encoding="UTF-8"?>
<page>
  <body>&quot;API&quot;:http://sargon.interinter.net/acts_as_file/ &quot;SVN&quot;:http://nimrod.interinter.net/plugins/trunk/acts_as_file

ActsAsFile is a Rails plugin which saves (uploaded) files to the file system.

h3. Installing

Download the plugin from &quot;Github&quot;:https://github.com/toretore/acts_as_file/tree and put it in your @vendor/plugins@ directory.

h3. Using

[ruby]
class Upload &lt; ActiveRecord::Base

  acts_as_file

  self.save_path = File.join(RAILS_ROOT, 'public', 'uploads')
  self.read_path = 'uploads'

end
[/ruby]

[ruby]
class UploadsController &lt; ActionController::Base

  def create
    upload = Upload.new(params[:upload])
    
    if upload.save
      flash[:notice] = 'File saved'
      redirect_to upload_url(upload)
    else
      flash[:error] = 'Could not save file'
      redirect_to new_upload_url
    end
  end

end
[/ruby]</body>
  <created-at type="datetime">2007-06-18T10:54:40-04:00</created-at>
  <id type="integer">16</id>
  <parent-id type="integer" nil="true"></parent-id>
  <published type="boolean">true</published>
  <slug>acts_as_file</slug>
  <summary></summary>
  <title>ActsAsFile</title>
  <updated-at type="datetime">2008-04-17T10:08:04-04:00</updated-at>
</page>
