I need to show a progress bar for file uploads and i have no idea. Any help will be appreciated.
Application is on Heroku and files are on S3
I'd use jQuery file upload which doesn't require flash, only javascript and is compatible with all browser (including IE6): https://github.com/blueimp/jQuery-File-Upload
I wrote the tutorial in the wiki and made a sample app here: https://github.com/apneadiving/Pic-upload---Crop-in-Ajax
Using both jQuery File Upload and Uploadify (on in each branch)
I have written a blog post about using rails 4 with paperclip and uploadify.
http://vignesh.info/blog/rails-4-uploadify-paperclip/
Paperclip already supports aws api and files can be stored on S3. If you have plans of using dropbox take a look at this gem https://github.com/janko-m/paperclip-dropbox
Related
I am looking for gem do preview image before upload image to work in my application Ruby on Rails.
Any suggestion ???
There is a jQuery File Upload Plugin that includes preview functionality. And there is a rails wrapper for it too: https://github.com/tors/jquery-fileupload-rails. I use it successfully in my projects.
I'm not aware of any gems that package this up, but the JavaScript to create an image preview is very easy if your browser supports FileReader API (good browsers and IE 10+). Mozilla has a basic example here.
Thanks!
I'm a complete beginner but I'd like to know even in a generic way so that my users could upload a file to another user's directory, the file gets saved on to a server and the receiving user could download it when the upload gets finished.
Since you're a complete beginner, I won't give you a lot of code; instead, I'll show you the overview of what you can do, and hopefully that will give you a much more refined approach to adopt:
Rails Uploads Using Paperclip
What makes Rails so powerful is the gem ecosystem - these are little plugins which give you functionality outside the scope of the Rails framework. You can get Gems for everything from file uploads to CSS frameworks - all for free
One of the most important & popular gems for Rails is Paperclip (and you have Carrierwave which also does the same job). These are what you use to process image uploads in Rails
Since you're a total beginner, you should really watch this Railscast about how to upload files with Rails using Paperclip:
There are also a lot of other tutorials on Paperclip:
Heroku's Paperclip Tutorial
Simple Paperclip tutorial
Another Paperclup tutorial
I would write some more updates about Paperclip & JQuery, but I think you should get your head around the upload process first
I'm using CarrierWave / Fog in a Rails application to upload videos to Amazon S3.
Is there a way to determine the progress of the upload, so that I can display
the upload progress being made?
CarrierWave and Fog don't have that kind of functionality natively; you'll need a front-end uploader to display progress stuff. When I had to solve this problem I used jQuery file upload because I already had jQuery in my stack. There's even a post on CarrierWave integration so you can just follow the instructions there to get a progress bar working for your app.
Have a look at this,
https://groups.google.com/group/ruby-fog/msg/45e8f0a63d973a6b
Does anyone have any sample code (preferrably in rails) that uploads to s3, using s3's servers.
Again, uploading directly to s3, where the actual upload/streaming is also preformed on amazon's servers.
Requirements:
Plupload, jQuery
Idea:
Authorize Upload via your app (sign it on server-side)
Use the signed request to upload the file to S3
Notify your app that the upload is done
Check whether S3 has received the file
I posted the code as a gist at https://gist.github.com/759939, it misses commments and you might run into some issues due to missing methods (had to rip it from our codebase).
stored_file.rb contains a model for your DB. Has many of paperclips helper methods inlined (which we used before we switched to direct upload to S3).
I hope you can use it as a sample to get your stuff running.
If you are using Rails 3, please check out my sample projects:
Sample project using Rails 3, Flash and MooTools-based FancyUploader to upload directly to S3: https://github.com/iwasrobbed/Rails3-S3-Uploader-FancyUploader
Sample project using Rails 3, Flash/Silverlight/GoogleGears/BrowserPlus and jQuery-based Plupload to upload directly to S3: https://github.com/iwasrobbed/Rails3-S3-Uploader-Plupload
To simply copy files, this is easy to use:
Smart Copy Script into S3
Amazon wrote a Ruby library for the S3 REST API. I haven't used it yet.
http://amazon.rubyforge.org/
One client project will be online two months later. One of the requirements changed is to support large files (10 to 15MB per RAW camera file, expected 1000 to 5000 files download per day) download worldwide for their customers. The process will be:
there is upload screen via paperclip to the rails local public folder
a hourly task to upload to web storage (S3?)
update the download url from paperclip url to the web url
Questions:
is there a gem/plug-in for this
purpose?
if no, any gem/plug-in
for S3 to recommend?
Questions about the storage provider:
is S3 recommended?
or other service to recommend?
The baseline is: the client's web server does not and will not have the bandwidth to handle the downloads.
Thanks
I don't think there is anything that will do all of this out of the box for you. Paperclip will push files sychronousy to S3 on upload, so you will need to make this ansychronous yourself.
S3 is rock-solid, I have used it in production on a number of projects. Totally recommended.
You can upload files directly to S3 which may help by reducing the double handling of the file (no longer need to upload to your app before pushing to Amazon):
http://developer.amazonwebservices.com/connect/entry.jspa?categoryID=139&externalID=1434
The aws-s3 and delayed_job gems are probably what you want.
gem install aws-s3
S3 is popular and widely used as far as I am aware.
If you end up going the route of uploading directly to S3 which offloads the work from your Rails server and makes it asynchronous, please check out my sample projects:
Sample project using Rails 3, Flash and MooTools-based FancyUploader to upload directly to S3: https://github.com/iwasrobbed/Rails3-S3-Uploader-FancyUploader
Sample project using Rails 3, Flash/Silverlight/GoogleGears/BrowserPlus and jQuery-based Plupload to upload directly to S3: https://github.com/iwasrobbed/Rails3-S3-Uploader-Plupload