Useful Paperclip Tutorials

Leave a comment

Here are some useful Tutorial for paperclip plugin in rails

1. For newly installed Paperclip in ruby 1.9.1, giving “Internal Error” and “invalid byte sequence in US-ASCII” with rack/utils.rb problem. Follow This

2. Paperclip Sample application. Here

3. Paperclip Sample application : Downloading files through controller. Here

4. Paperclip Sample Application : Storing attached file in database BLOB column. Here and one More

5. Paperclip upload file using single database table. Here

6. Paperclip Sample application download. Here

7. Good tutorial on attaching a file using Paperclip.

8. Uploading multiple images using Paperclip. Here

9. RoR Paperclip plugin tutorial. Here

Share this post using following toolbar:

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

- Abhishek Singh

I'm supporting RubyConf India 2010

Problem with Paperclip in Ruby 1.9.1, Rails 2.3.4

Leave a comment

I tried Paperclip plugin with Ruby 1.9.1. Everything goes right but when i upload a image file, i got a “Something went wrong” error in browser. In Server console i got something like :

/!\ FAILSAFE /!\

Status: 500 Internal Server Error
  invalid byte sequence in US-ASCII
    /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/utils.rb:320:in `=~'
    /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/
action_controller/vendor/rack-1.0/rack/utils.rb:320:in `block in
parse_multipart'.....etc

After some Googling, i got solution. This works fine for my application. Follow these steps:

  1. Change Directory to where ruby 1.9.1 rack gem is installed (in my case it’s /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack)
  2. Open utils.rb file
  3. apply following patch:Line No. 1     + # coding=binary
    Line No.2      +
Following lines are already present :
Line No.3            require ’set’
Line No.4            require ‘tempfile’
Around Line number 350 replace the following line:
       boundary_size = boundary.size + EOL.size

with this one:

       boundary_size = Utils.bytesize(boundary) + EOL.size

nd then follwing lines are already present:

   bufsize = 16384
   content_length -= boundary_size

4. Save utils.rb file

5. Restart Server and now able to upload and view the image file.

Patch Reference is here.

-Abhishek Singh

V2 Theme Song

Leave a comment

I like the Theme song of my company (V2Solutions), “V2 Hamara Hai“……


-Abhishek Singh

Follow

Get every new post delivered to your Inbox.