# Can rails even gracefully upload?

**URL:** <https://www.ruby-forum.com/t/can-rails-even-gracefully-upload/181087>\
**Category:** Rails\
**Created:** [January 5, 2010, 8:21am UTC](https://www.ruby-forum.com/t/can-rails-even-gracefully-upload/181087 "2010-01-05T08:21:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@brianp](https://www.ruby-forum.com/u/brianp)\
**Post date:** [January 5, 2010, 8:21am UTC](https://www.ruby-forum.com/t/can-rails-even-gracefully-upload/181087/1 "2010-01-05T08:21:07Z")

</div>

Sorry I really just wanted to have a title to catch attention.

I’ve had no luck with attachment\_fu. It almost works but I’ve failed  
at finding a solution to it’s pitfalls.  
([http://groups.google.ca/group/rubyonrails-talk/browse\_thread/thread/](http://groups.google.ca/group/rubyonrails-talk/browse_thread/thread/)  
1101ec5b888b3020/a0418430e0b59f42?lnk=gst&q=brianp#a0418430e0b59f42)  
&  
([http://groups.google.ca/group/rubyonrails-talk/browse\_thread/thread/](http://groups.google.ca/group/rubyonrails-talk/browse_thread/thread/)  
c0cf0dc1f54b4058/d845bcc159691698?q=#d845bcc159691698)

And Have now failed trying a method described using paperclip.  
([http://www.mfischer.com/2009/02/02/multiple-image-upload-and-crop-](http://www.mfischer.com/2009/02/02/multiple-image-upload-and-crop-)  
with-rails/)

This is a major problem. It’s the only thing currently holding back a  
project. I can get a simple uploads to occur. but as soon as i need  
multiple related attachments and resizing things fall apart. I do  
blame myself being a novice with rails but at the same time, it can’t  
possibly be this hard.

Every demo, tutorial, article I find is almost a year outdated. And  
even most of the demos they give with them fail with rails 2.3.5.

Please prove me wrong and tell me how you manage multiple file uploads.

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![brianp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@brianp](https://www.ruby-forum.com/u/brianp)\
**Post date:** [January 5, 2010, 11:45am UTC](https://www.ruby-forum.com/t/can-rails-even-gracefully-upload/181087/2 "2010-01-05T11:45:23Z")

</div>

On Jan 5, 9:19 am, brianp [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> And Have now failed trying a method described using paperclip.  
> even most of the demos they give with them fail with rails 2.3.5.
> 
> Please prove me wrong and tell me how you manage multiple file uploads.

Hi Brian,

I found myself in the same boat a couple of months ago.  
Have you taken a look at paperclip? Its basically the new gen  
attachment\_fu.  
[http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails/](http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails/)

Hope this helps,  
it worked for me.

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![brianp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@brianp](https://www.ruby-forum.com/u/brianp)\
**Post date:** [January 5, 2010, 7:40pm UTC](https://www.ruby-forum.com/t/can-rails-even-gracefully-upload/181087/3 "2010-01-05T19:40:43Z")

</div>

I personally use paperclip, and not attachment-fu, but I also usually  
end up  
making an Asset model that is polymorphically associated with my other  
models. That way, I can keep all of my file handling stuff in one place,  
as  
well as keeping the number of attachments flexible.

---

<div class="post-metadata">

**Author:** ![brianp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@brianp](https://www.ruby-forum.com/u/brianp)\
**Post date:** [January 6, 2010, 5:42pm UTC](https://www.ruby-forum.com/t/can-rails-even-gracefully-upload/181087/4 "2010-01-06T17:42:14Z")

</div>

brianp wrote:

> This is a major problem. It’s the only thing currently holding back a  
> project. I can get a simple uploads to occur. but as soon as i need  
> multiple related attachments and resizing things fall apart. I do  
> blame myself being a novice with rails but at the same time, it can’t  
> possibly be this hard.

I have used attachment\_fu in the past. I’ve not used it recently though.  
I do understand your frustrations even though I have few problems  
getting up and running with attachment\_fu.

I do believe that most Rails developers now use Paperclip, which I have  
not yet had the opportunity to try. I will try it the next time I have a  
need.

Part of the frustration with file uploads really have nothing to do with  
Rails specifically. Uploading content to a server is in opposition with  
security. This fundamentally makes multiple-file uploads somewhat  
painful. Direct access to the local file system is specifically limited  
in web browsers. JavaScript for example has no access to the local file  
system.

There are workarounds, but most of them feel like a hack in themselves  
to me. List swfupload, which I believe uses Flash to workaround the file  
access issue (since Flash is fundamentally insecure anyway). Other  
alternatives I’ve seen is Java applets to introduce another hackish  
workaround for this issue. This can also be a very annoying and  
unreliable solution.

Wish I had more to offer in the way of actual help. I do empathize with  
your frustrations in this area.

“Convenience is the enemy of security.”

---

<div class="post-metadata">

**Author:** ![brianp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@brianp](https://www.ruby-forum.com/u/brianp)\
**Post date:** [January 7, 2010, 12:10am UTC](https://www.ruby-forum.com/t/can-rails-even-gracefully-upload/181087/5 "2010-01-07T00:10:28Z")

</div>

On 06 Jan 2010, at 17:42, Robert W. wrote:

> getting up and running with attachment\_fu.  
> with  
> access issue (since Flash is fundamentally insecure anyway). Other  
> alternatives I’ve seen is Java applets to introduce another hackish  
> workaround for this issue. This can also be a very annoying and  
> unreliable solution.
> 
> Wish I had more to offer in the way of actual help. I do empathize  
> with  
> your frustrations in this area.

We have projects that use SWFUpload for multiple uploads and that  
includes uploading files going up to hundreds of megabytes, with  
resizing and thumbnailing. Rails uses attachment\_fu or paperclip, it  
doesn’t matter, they both perform fine. Just make sure u tell  
attachment\_fu models to allow files up to the limit you set and use a  
rack middleware to preserve the session and/or set the mimetype,  
because Flash doesn’t preserve it properly. Just google for it.  
Everything else is just clientside stuff.

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![brianp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@brianp](https://www.ruby-forum.com/u/brianp)\
**Post date:** [January 7, 2010, 3:06pm UTC](https://www.ruby-forum.com/t/can-rails-even-gracefully-upload/181087/6 "2010-01-07T15:06:44Z")

</div>

brianp,

Checkout these railscasts:

> **[\#134 Paperclip - RailsCasts](http://railscasts.com/episodes/134-paperclip)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

> **[\#182 Cropping Images - RailsCasts](http://railscasts.com/episodes/182-cropping-images)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

both used paperclip and they got me up and running in an hr or so. If  
you need help e-mail me directly as I only read the group discussion  
every day or so.

Brian

---

<div class="post-metadata">

**Author:** ![brianp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@brianp](https://www.ruby-forum.com/u/brianp)\
**Post date:** [January 8, 2010, 10:30am UTC](https://www.ruby-forum.com/t/can-rails-even-gracefully-upload/181087/7 "2010-01-08T10:30:27Z")

</div>

Thanks for all the replies everyone.

Just for the record it’s not uploading that’s the problem as mentioned  
by some above it’s multiple simultaneous uploads that’s the problem.

I think I’ve come up with a half decent solution for the problem which  
I’ll gladly post when finished. But I’ve run into another problem  
since. My ImageMagick appears to have run into a new problem. It will  
no longer resize images. I’ve tried re-installing and still receive  
this problem:

[paperclip] An error was received while processing:  
#\<Paperclip::NotIdentifiedByImageMagickError: /var/folders/4s/  
4sQnoBr2F2yB6Y37PPp9U++++TI/-Tmp-/1222566365812,87876,0.jpg is not  
recognized by the ‘identify’ command.\>

All available searching points in the direction of path problems. I’ve  
tried everything below to no avail (and multiple combination of the  
such):  
Paperclip.options[:swallow\_stderr] = false  
Paperclip.options[:command\_path] = “/usr/bin”  
Paperclip.options[:command\_path] = “/opt/local/bin”  
Paperclip.options[:command\_path] = “/usr/local/ImageMagick/”  
Paperclip.options[:image\_magick\_path] = ‘/opt/local/bin’

I did notice one post verifying the working processes for convert and  
identify in /opt/local/bin. I checked for those process in that folder  
and came up empty handed. How can i test these at the command line and  
what should i do if they don’t work?

I re-installed via Mac Ports.

thanks,  
bp
