Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

file_uploader

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file_uploader

  • 0.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= File Uploader

Focus more on your domain not file upload. Let file_uploader do it.

== Installation

gem install file_uploader

== Usage in Rails

Open and edit config/environment.rb and add a line in Rails::Initializer.run do |config|

config.gem "file_uploader"

In your controller

class UploadController < ApplicationController

def index
  if request.post?
    uploader = FileUploader.create # File is uploaded to public/upload directory
    uploader.save(params[:uploader][:file]) { |path|
      render :text => "#{path} is successfully saved."
    }
  end
end

end

Upload to a different directory

uploader = FileUploader.create "public/a/b/c/d/e/f" # Directory hierarchy will be created and file will be saved to that location

== More

Uploaded filename is sanitized and will have a random prefix automatically to prevent duplication.

FileUploader.save accept a block with path to the uploaded file.

== Sinatra?

https://gist.github.com/799695

FAQs

Package last updated on 09 Apr 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc