Uploading any type of file faster in rails

Hi all,
I am working in rails (1.2.6 version), i developed file upload using file_column plugin in my application, it is working fine, but thought that it is bit slow.
i need another upload system that make the rails faster for upload and it should match for my version (1.2.6). Instead of uploading a single file (eg:10 mb file).
i) Can we split the file into say 5 mb,5mb. in the client side and upload both splited file by running multiple thread in serverside ?. (Is that possible ?)
ii) Which upload system/technic/plugin is faster and efficient for this version (1.2.6) ?
iii) How can we create file upload like facebook, it is very fast, they provide plugin for client side and upload the file in background. ?
iv) which plugin good for upload
a). Act as Attachement
b). Paper clip
c). attachment_fu

v) Required:
a) Easy integration with rmagick or similar image processing plugins

b) Simple to use and customize

vi) Nice to have:
a) Multiple uploads

b) progress bar

Rejoice + o +
Arun Kumar .J
http://railsbuilder.blogspot.com

I am working in rails (1.2.6 version), i developed file upload using file_column plugin in my application, it is working fine, but thought that it is bit slow.
i need another upload system that make the rails faster for upload and it should match for my version (1.2.6). Instead of uploading a single file (eg:10 mb file).

i) Can we split the file into say 5 mb,5mb. in the client side and upload both splited file by running multiple thread in serverside ?. (Is that possible ?)

The upload speed of the file will in 99% of all cases be determined by the maximum upload speed on the client side. If the user’s upload is capped to 128kbit/sec, nothing is going to make it faster. Another reason could be you are hosting your app on a shared host, moving to a more appropriate VPS host close to your location is your way to go then. If you’re hosting internally and your app is slow, then your server might not be up to the task anymore.

ii) Which upload system/technic/plugin is faster and efficient for this version (1.2.6) ?

They are all equally fast, the bottleneck isn’t on the server side.

iii) How can we create file upload like facebook, it is very fast, they provide plugin for client side and upload the file in background. ?

You can read the whole background about the facebook upload plugin at:

http://www.facebook.com/note.php?note_id=178492968919

Good luck programming a similar plugin yourself, as far as I know Facebook hasn’t opensourced it. It’s a very nice thing they did btw, the uploads actually aren’t faster than normal, facebook developers have just been able to make the perception of the upload time different by using their local thumbnailing and background uploading. This is all clientside of course and has nothing to do with the serverside.

iv) which plugin good for upload
a). Act as Attachement
b). Paper clip
c). attachment_fu

Paperclip is the plugin I currently prefer, but I’m not sure if it’s still compatible with your very old Rails version. Acts as attachment is an even older version of attachment_fu and should be avoided.

v) Required:
a) Easy integration with rmagick or similar image processing plugins
b) Simple to use and customize

They all do that. It comes down to what API you prefer. Read the docs and decide from there. Do know that RMagick is a hefty library and it uses quite a good chunk of memory. If you want to process files, make sure your server is up to the task (i.e. don’t make it run on a Commodore 64 that already has 500 other PHP forums running on it).

vi) Nice to have:
a) Multiple uploads
b) progress bar

This is clientside technology and can be achieved with either a Flash based uploader (SWFupload for example), Java applet (don’t know any cos I dislike Java apps in my browser) or a serverside upload monitor like mongrel_upload_progress. They all require quite good knowledge of the technology you’re using. Flash based uploaders use Javascript for the most part, so you’d better be comfortable with it. Simply googling for “rails multiple upload” should give you enough pointers to get started.

Best regards

Peter De Berdt

Thanks Peter De Berdt,

The explanation clear and cool, will check with that and come back again for nice discussion with you.

Hi Peter,

I got clear idea from ur reply. So i stay back with file_column plugin, now what i need is a very simple progress bar to show the upload status
i googled for mongrel_upload_progress but i didn’t find any clear doc, please suggest me on this. I need to implement very simple progress bar, Is there any sample swfupload application available for rails like PHP, Asp. Actually i don’t need multiple upload feature i need just upload progress bar.

Thanks in advance.

I doubt there will be one for the old Rails version you are using, but http://www.google.com/search?q=rails+swfupload+example should help you. Another big help would be to read the docs from the component you are using instead of looking for prechewed food.

Some links that immediately stand out:

http://github.com/davidsouth/rails-swfupload

http://www.ruby-forum.com/topic/161291

Good luck!

Best regards

Peter De Berdt