diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2cf7b75
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+.DS_Store
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/**/*
+/*.log
\ No newline at end of file
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..dc35805
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,35 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.7'
+gem 'haml-rails'
+
+# there is an issue with rake 0.9.0
+gem 'rake', '~> 0.8.7'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
+# gem 'ruby-debug'
+# gem 'ruby-debug19', :require => 'ruby-debug'
+
+# Bundle the extra gems:
+# gem 'bj'
+# gem 'nokogiri'
+# gem 'sqlite3-ruby', :require => 'sqlite3'
+# gem 'aws-s3', :require => 'aws/s3'
+
+# Bundle gems for the local environment. Make sure to
+# put test-only gems in this group so their generators
+# and rake tasks are available in development mode:
+# group :development, :test do
+# gem 'webrat'
+# end
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000..62c83c1
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,81 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.7)
+ actionpack (= 3.0.7)
+ mail (~> 2.2.15)
+ actionpack (3.0.7)
+ activemodel (= 3.0.7)
+ activesupport (= 3.0.7)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.5.0)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.14)
+ rack-test (~> 0.5.7)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.7)
+ activesupport (= 3.0.7)
+ builder (~> 2.1.2)
+ i18n (~> 0.5.0)
+ activerecord (3.0.7)
+ activemodel (= 3.0.7)
+ activesupport (= 3.0.7)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.7)
+ activemodel (= 3.0.7)
+ activesupport (= 3.0.7)
+ activesupport (3.0.7)
+ arel (2.0.10)
+ builder (2.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ haml (3.1.1)
+ haml-rails (0.3.4)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
+ haml (~> 3.0)
+ railties (~> 3.0)
+ i18n (0.5.0)
+ mail (2.2.19)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ polyglot (0.3.1)
+ rack (1.2.3)
+ rack-mount (0.6.14)
+ rack (>= 1.0.0)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ rails (3.0.7)
+ actionmailer (= 3.0.7)
+ actionpack (= 3.0.7)
+ activerecord (= 3.0.7)
+ activeresource (= 3.0.7)
+ activesupport (= 3.0.7)
+ bundler (~> 1.0)
+ railties (= 3.0.7)
+ railties (3.0.7)
+ actionpack (= 3.0.7)
+ activesupport (= 3.0.7)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ sqlite3 (1.3.3)
+ thor (0.14.6)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.27)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ haml-rails
+ rails (= 3.0.7)
+ rake (~> 0.8.7)
+ sqlite3
diff --git a/README.markdown b/README.markdown
new file mode 100644
index 0000000..e1aace8
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,47 @@
+## Updated for Rails 3 & PLUpload
+This is just a sample app using Rails 3 which allows you to upload directly to Amazon S3 and bypass the Rails server entirely. This is useful for cloud hosting like Heroku which has a 30 second request timeout and resets the connection on any uploads which go over that limit.
+
+- Uploading: [PLUpload](http://plupload.com)
+- Uploading Technology: **jQuery API** using **Flash, Google Gears, Silverlight, BrowserPlus, HTML5** to do the heavy lifting
+
+**Note**: Currently Amazon S3 **DOES NOT** support HTML5 uploading. [More info here](https://forums.aws.amazon.com/thread.jspa?threadID=34281)
+
+## Debugging Flash Uploaders
+For debugging purposes involving Flash uploading, I would highly recommend using the [WireShark](http://www.wireshark.org/download.html) tool which allows you to sniff the network traffic for XML responses sent back from Amazon S3.
+
+Link to download WireShark: http://www.wireshark.org/download.html
+How to install on MacOSX: http://www.youtube.com/watch?v=IxeHm0BKdwc
+
+Amazon S3 will always send back an XML response to the Flash uploader and currently the uploader does nothing with it except give a vague error response which isn't helpful.
+
+So what you have to do is first close out other items that may be using the internet at the moment (to minimize noise) and then run WireShark and capture the network traffic while you try and upload a file. You'll start to see a whole bunch of stuff show up in WireShark so go ahead and filter it out by typing "xml" into the Filter box at the top of the window. This will show only the XML responses back from S3 like this: http://i.imgur.com/VZ5ZC.png
+
+The one that is highlighted in that image is a 403 forbidden response which could mean that you are missing something in your Amazon S3 policy or that you have extra keys that it doesn't know about. Some uploaders actually send extra data with the request (like the **name** item shown) that Amazon doesn't know about so you have to tell it to accept the params with any value, which is what the blank `starts-with` in the policy item does:
+
+ ['starts-with', '$name', ''],
+
+Hopefully WireShark helps you solve many headaches in the future. Happy uploading!
+
+## Steps to make the example work:
+
+- Clone this repo and run `bundle install`
+
+- Add your S3 bucket and keys to `config/amazon_s3.yml`
+
+- **For Flash**: Make sure a public readable `crossdomain.xml` exists in the root directory of the S3 bucket you specified in `config/amazon_s3.yml`, with the following content (once you get it working, you **should** limit access to your domain to be more secure). An example can be [found here](https://gist.github.com/995182)
+
+- **For Silverlight**: Make sure a public readable `clientaccesspolicy.xml` exists in the root directory of the S3 bucket you specified in `config/amazon_s3.yml`, with the following content (once you get it working, you **should** limit access to your domain to be more secure). An example can be [found here](https://gist.github.com/gists/995348/edit)
+
+- Also make sure a folder named **test** exists in that bucket (if not, one will be created). Files will be uploaded to that folder.
+
+- Run the server locally or push it up to Heroku and start uploading files.
+
+- If you want to explore the code, the bulk of it is in the `helpers/uploads_helper.rb` file and then a convenient helper for using/customizing the uploader can be found in the `views/uploads/new.html.haml` file
+
+**Note** PLUpload uses CSS to absolutely position the Flash/Silverlight objects over top of your custom "Upload" button, so if you move that button at all during the upload process the Flash/Silverlight object will still be there. What you can do is target the `div` that gets created for the object and then change it's CSS properties like this:
+
+## Credits
+### Original Author
+Nico Ritsche: https://github.com/ncri
+### Original Blog Post
+http://www.railstoolkit.com/posts/rails-amazon-s3-uploader-with-progress-bar-2010-update
\ No newline at end of file
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..d3a55c1
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,7 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+require 'rake'
+
+S3Uploader::Application.load_tasks
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
new file mode 100644
index 0000000..e8065d9
--- /dev/null
+++ b/app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb
new file mode 100644
index 0000000..89e38c6
--- /dev/null
+++ b/app/controllers/uploads_controller.rb
@@ -0,0 +1,5 @@
+class UploadsController < ApplicationController
+ def new
+ # show default new.html page
+ end
+end
\ No newline at end of file
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/app/helpers/uploads_helper.rb b/app/helpers/uploads_helper.rb
new file mode 100644
index 0000000..a231ac5
--- /dev/null
+++ b/app/helpers/uploads_helper.rb
@@ -0,0 +1,148 @@
+module UploadsHelper
+
+ # Creates an instance of a plupload S3 file uploader
+ ###
+ # required parameters:
+ ###
+ # key s3 'path' to uploaded files
+ #
+ ###
+ # optional parameters:
+ ###
+ # s3_config_filename filename of s3 config yaml file (full path), defaults to "#{RAILS_ROOT}/config/amazon_s3.yml"
+ #
+ # content_type binary/octet-stream
+ #
+ # acl public-read
+ #
+ # expiration_date 10.hours.from_now.utc.iso8601
+ #
+ # max_filesize 2.megabytes
+
+ def s3_uploader(options = {})
+ options[:s3_config_filename] ||= "#{RAILS_ROOT}/config/amazon_s3.yml"
+ config = YAML.load_file(options[:s3_config_filename])
+ bucket = config[RAILS_ENV]['bucket_name']
+ access_key_id = config[RAILS_ENV]['access_key_id']
+ secret_access_key = config[RAILS_ENV]['secret_access_key']
+
+ options[:key] ||= 'test' # folder on AWS to store file in
+ options[:acl] ||= 'public-read'
+ options[:expiration_date] ||= 10.hours.from_now.utc.iso8601
+ options[:max_filesize] ||= 500.megabytes
+ options[:content_type] ||= 'image/' # Videos would be binary/octet-stream
+ options[:filter_title] ||= 'Images'
+ options[:filter_extentions] ||= 'jpg,jpeg,gif,png,bmp'
+
+ id = options[:id] ? "_#{options[:id]}" : ''
+
+ policy = Base64.encode64(
+ "{'expiration': '#{options[:expiration_date]}',
+ 'conditions': [
+ {'bucket': '#{bucket}'},
+ {'acl': '#{options[:acl]}'},
+ {'success_action_status': '201'},
+ ['content-length-range', 0, #{options[:max_filesize]}],
+ ['starts-with', '$key', ''],
+ ['starts-with', '$Content-Type', ''],
+ ['starts-with', '$name', ''],
+ ['starts-with', '$Filename', '']
+ ]
+ }").gsub(/\n|\r/, '')
+
+ signature = Base64.encode64(
+ OpenSSL::HMAC.digest(
+ OpenSSL::Digest::Digest.new('sha1'),
+ secret_access_key, policy)).gsub("\n","")
+
+ out = ""
+
+ out << javascript_tag("$(function() {
+
+ /*
+ * S3 Uploader instance
+ */
+ // image uploader via plupload
+ var uploader = new plupload.Uploader({
+ runtimes : 'flash,silverlight',
+ browse_button : 'pickfiles',
+ max_file_size : '500mb',
+ url : 'http://#{bucket}.s3.amazonaws.com/',
+ flash_swf_url: '/javascripts/plupload/plupload.flash.swf',
+ silverlight_xap_url: '/javascripts/plupload/plupload.silverlight.xap',
+ init : {
+ FilesAdded: function(up, files) {
+ plupload.each(files, function(file) {
+ if (up.files.length > 1) {
+ up.removeFile(file);
+ }
+ });
+ if (up.files.length >= 1) {
+ $('#pickfiles').fadeOut('slow');
+ }
+ },
+ FilesRemoved: function(up, files) {
+ if (up.files.length < 1) {
+ $('#pickfiles').fadeIn('slow');
+ }
+ }
+ },
+ multi_selection: false,
+ multipart: true,
+ multipart_params: {
+ 'key': 'test/${filename}',
+ 'Filename': '${filename}', // adding this to keep consistency across the runtimes
+ 'acl': '#{options[:acl]}',
+ 'Content-Type': '#{options[:content_type]}',
+ 'success_action_status': '201',
+ 'AWSAccessKeyId' : '#{access_key_id}',
+ 'policy': '#{policy}',
+ 'signature': '#{signature}'
+ },
+ filters : [
+ {title : '#{options[:filter_title]}', extensions : '#{options[:filter_extentions]}'}
+ ],
+ file_data_name: 'file'
+ });
+
+ // instantiates the uploader
+ uploader.init();
+
+ // shows the progress bar and kicks off uploading
+ uploader.bind('FilesAdded', function(up, files) {
+ $('#progress_bar .ui-progress').css('width', '5%');
+ $('span.ui-label').show();
+
+ // start the uploader after the progress bar shows
+ $('#progress_bar').show(function () {
+ uploader.start();
+ });
+ });
+
+ // binds progress to progress bar
+ uploader.bind('UploadProgress', function(up, file) {
+ if(file.percent < 100){
+ $('#progress_bar .ui-progress').css('width', file.percent+'%');
+ }
+ else {
+ $('#progress_bar .ui-progress').css('width', '100%');
+ $('span.ui-label').text('Complete');
+ }
+ });
+
+ // shows error object in the browser console (for now)
+ uploader.bind('Error', function(up, error) {
+ // unfortunately PLUpload gives some extremely vague
+ // Flash error messages so you have to use WireShark
+ // for debugging them (read the README)
+
+ alert('There was an error. Check the browser console log for more info');
+ console.log('Expand the error object below to see the error. Use WireShark to debug.');
+
+ console.log(error);
+ });
+
+ });")
+
+ end
+end
\ No newline at end of file
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
new file mode 100644
index 0000000..cdf3f3a
--- /dev/null
+++ b/app/views/layouts/application.html.haml
@@ -0,0 +1,12 @@
+!!! Strict
+%html
+ %head
+ %title= "S3 Uploader using PLUpload"
+ = stylesheet_link_tag "styles"
+ = javascript_include_tag( 'jquery-1.5.js',
+ 'plupload/plupload.full' )
+
+ %meta{ 'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}
+
+ %body
+ = yield
\ No newline at end of file
diff --git a/app/views/uploads/new.html.haml b/app/views/uploads/new.html.haml
new file mode 100644
index 0000000..fc8f278
--- /dev/null
+++ b/app/views/uploads/new.html.haml
@@ -0,0 +1,10 @@
+.tcenter.grayField.ral
+ %h2.borderBottom Upload New Image
+ #progress_bar.ui-progress-bar.ui-container
+ .ui-progress{:style => "width: 5%;"}
+ %span.ui-label{:style => "display:none;"}
+ Uploading
+
+ :plain
+ #{s3_uploader(:max_filesize => 500.megabytes)}
+ %a{:id => "pickfiles", :href => "#", :class => "medium silver button ram"} Select image
\ No newline at end of file
diff --git a/config.ru b/config.ru
new file mode 100644
index 0000000..3d9fc58
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run S3Uploader::Application
diff --git a/config/amazon_s3.yml b/config/amazon_s3.yml
new file mode 100644
index 0000000..ec4164c
--- /dev/null
+++ b/config/amazon_s3.yml
@@ -0,0 +1,8 @@
+development:
+ bucket_name: bucket_name_goes_here
+ access_key_id: access_key_goes_here
+ secret_access_key: secret_key_goes_here
+production:
+ bucket_name: bucket_name_goes_here
+ access_key_id: access_key_goes_here
+ secret_access_key: secret_key_goes_here
\ No newline at end of file
diff --git a/config/application.rb b/config/application.rb
new file mode 100644
index 0000000..da792fa
--- /dev/null
+++ b/config/application.rb
@@ -0,0 +1,42 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+# If you have a Gemfile, require the gems listed there, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(:default, Rails.env) if defined?(Bundler)
+
+module S3Uploader
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ # config.autoload_paths += %W(#{config.root}/extras)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # JavaScript files you want as :defaults (application.js is always included).
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+ end
+end
diff --git a/config/boot.rb b/config/boot.rb
new file mode 100644
index 0000000..4489e58
--- /dev/null
+++ b/config/boot.rb
@@ -0,0 +1,6 @@
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
diff --git a/config/database.yml b/config/database.yml
new file mode 100644
index 0000000..90d87cc
--- /dev/null
+++ b/config/database.yml
@@ -0,0 +1,22 @@
+# SQLite version 3.x
+# gem install sqlite3
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000
+
+production:
+ adapter: sqlite3
+ database: db/production.sqlite3
+ pool: 5
+ timeout: 5000
diff --git a/config/environment.rb b/config/environment.rb
new file mode 100644
index 0000000..008040e
--- /dev/null
+++ b/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+S3Uploader::Application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
new file mode 100644
index 0000000..a79c345
--- /dev/null
+++ b/config/environments/development.rb
@@ -0,0 +1,26 @@
+S3Uploader::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the webserver when you make code changes.
+ config.cache_classes = false
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_view.debug_rjs = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+end
+
diff --git a/config/environments/production.rb b/config/environments/production.rb
new file mode 100644
index 0000000..fd8b69f
--- /dev/null
+++ b/config/environments/production.rb
@@ -0,0 +1,49 @@
+S3Uploader::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # The production environment is meant for finished, "live" apps.
+ # Code is not reloaded between requests
+ config.cache_classes = true
+
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Specifies the header that your server uses for sending files
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
+
+ # For nginx:
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
+
+ # If you have no front-end server that supports something like X-Sendfile,
+ # just comment this out and Rails will serve the files
+
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
+
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
+
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
+
+ # Disable Rails's static asset server
+ # In production, Apache or nginx will already do this
+ config.serve_static_assets = false
+
+ # Enable serving of images, stylesheets, and javascripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
+
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable threaded mode
+ # config.threadsafe!
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
+end
diff --git a/config/environments/test.rb b/config/environments/test.rb
new file mode 100644
index 0000000..65ab3a8
--- /dev/null
+++ b/config/environments/test.rb
@@ -0,0 +1,35 @@
+S3Uploader::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
+end
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
new file mode 100644
index 0000000..59385cd
--- /dev/null
+++ b/config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
new file mode 100644
index 0000000..9e8b013
--- /dev/null
+++ b/config/initializers/inflections.rb
@@ -0,0 +1,10 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format
+# (all these examples are active by default):
+# ActiveSupport::Inflector.inflections do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
new file mode 100644
index 0000000..72aca7e
--- /dev/null
+++ b/config/initializers/mime_types.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
+# Mime::Type.register_alias "text/html", :iphone
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb
new file mode 100644
index 0000000..3826ca4
--- /dev/null
+++ b/config/initializers/secret_token.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+S3Uploader::Application.config.secret_token = 'ea1293525d9683d707c282c6dd4b645ba574fab5f02d097ef03daf575ed333190fc4a71d0dfc6d6d903227cf0c823d620e9744cff959f9025ef2f9394d6f0760'
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
new file mode 100644
index 0000000..fd2f828
--- /dev/null
+++ b/config/initializers/session_store.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+S3Uploader::Application.config.session_store :cookie_store, :key => '_s3_uploader_session'
+
+# Use the database for sessions instead of the cookie-based default,
+# which shouldn't be used to store highly confidential information
+# (create the session table with "rails generate session_migration")
+# S3Uploader::Application.config.session_store :active_record_store
diff --git a/config/locales/en.yml b/config/locales/en.yml
new file mode 100644
index 0000000..a747bfa
--- /dev/null
+++ b/config/locales/en.yml
@@ -0,0 +1,5 @@
+# Sample localization file for English. Add more files in this directory for other locales.
+# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+
+en:
+ hello: "Hello world"
diff --git a/config/routes.rb b/config/routes.rb
new file mode 100644
index 0000000..33f2715
--- /dev/null
+++ b/config/routes.rb
@@ -0,0 +1,61 @@
+S3Uploader::Application.routes.draw do
+
+ root :to => 'uploads#new'
+
+ # The priority is based upon order of creation:
+ # first created -> highest priority.
+
+ # Sample of regular route:
+ # match 'products/:id' => 'catalog#view'
+ # Keep in mind you can assign values other than :controller and :action
+
+ # Sample of named route:
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
+ # This route can be invoked with purchase_url(:id => product.id)
+
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
+ # resources :products
+
+ # Sample resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
+
+ # Sample resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
+ # Sample resource route with more complex sub-resources
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', :on => :collection
+ # end
+ # end
+
+ # Sample resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
+
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
+ # root :to => "welcome#index"
+
+ # See how all your routes lay out with "rake routes"
+
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
+ # Note: This route will make all actions in every controller accessible via GET requests.
+ # match ':controller(/:action(/:id(.:format)))'
+end
diff --git a/db/seeds.rb b/db/seeds.rb
new file mode 100644
index 0000000..664d8c7
--- /dev/null
+++ b/db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
+# Mayor.create(:name => 'Daley', :city => cities.first)
diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP
new file mode 100644
index 0000000..fe41f5c
--- /dev/null
+++ b/doc/README_FOR_APP
@@ -0,0 +1,2 @@
+Use this README file to introduce your application and point to useful places in the API for learning more.
+Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/public/404.html b/public/404.html
new file mode 100644
index 0000000..eff660b
--- /dev/null
+++ b/public/404.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
+
\ No newline at end of file
diff --git a/public/422.html b/public/422.html
new file mode 100644
index 0000000..b54e4a3
--- /dev/null
+++ b/public/422.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
+
\ No newline at end of file
diff --git a/public/500.html b/public/500.html
new file mode 100644
index 0000000..ec3bbf0
--- /dev/null
+++ b/public/500.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
We've been notified about this issue and we'll take a look at it shortly.
+
+
+
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/public/images/rails.png b/public/images/rails.png
new file mode 100644
index 0000000..d5edc04
Binary files /dev/null and b/public/images/rails.png differ
diff --git a/public/javascripts/jquery-1.5.js b/public/javascripts/jquery-1.5.js
new file mode 100644
index 0000000..9144b8a
--- /dev/null
+++ b/public/javascripts/jquery-1.5.js
@@ -0,0 +1,16 @@
+/*!
+ * jQuery JavaScript Library v1.5
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Mon Jan 31 08:31:29 2011 -0500
+ */
+(function(a,b){function b$(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function bX(a){if(!bR[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bR[a]=c}return bR[a]}function bW(a,b){var c={};d.each(bV.concat.apply([],bV.slice(0,b)),function(){c[this]=a});return c}function bJ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f=a.converters,g,h=e.length,i,j=e[0],k,l,m,n,o;for(g=1;g=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(q,"`").replace(r,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,p,q=[],r=[],s=d._data(this,u);typeof s==="function"&&(s=s.events);if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;ic)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,p=f.handleObj.origHandler.apply(f.elem,arguments);if(p===!1||a.isPropagationStopped()){c=f.level,p===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,b,c){c[0].type=a;return d.event.handle.apply(b,c)}function w(){return!0}function v(){return!1}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");e.type="text/javascript",d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g1?(g=Array(c),d.each(b,function(a,b){d.when(b).then(function(b){g[a]=arguments.length>1?E.call(arguments,0):b,--c||e.resolveWith(f,g)},e.reject)})):e!==a&&e.resolve(a);return f},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return a.jQuery=a.$=d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML="