简体   繁体   English

Rails Amazon S3如何创建文件上传进度栏?

[英]Rails Amazon S3 how to create a File Upload Progress Bar?

How do I create a upload field that uploads the file as soon as it is picked? 如何创建一个上载字段,以便在选择文件后立即上载文件? With a nice status bar on the upload. 在上传状态栏上显示一个不错的状态。 I am using paperclip for the image uploads with Amazon S3 server. 我正在使用回形针通过Amazon S3服务器上传图像。 I have see this plugin https://github.com/nathancolgate/s3-swf-upload-plugin but I am not sure how I should use it. 我已经看到了这个插件https://github.com/nathancolgate/s3-swf-upload-plugin,但是我不确定应该如何使用它。

My form: 我的表格:

<%= simple_form_for @photographer, :url => savenew_admin_photographers_path, :html => { :multipart => true, :method => :post} do |f| %>
<%= f.label "Upload image" %><br />
<%= f.input :image, :label => '', :required => true %><br />
<%= f.label "Upload flv" %><br />
<%= f.input :flv, :label => '', :required => true %><br />
<%= f.label "Upload Quicktime"  %><br />
<%= f.input :quicktime, :label => '', :required => true %><br />
<%= f.button :submit, :value => 'Create movie' %>

You should look into JQuery file uploader . 您应该研究JQuery文件上传器 I'd recommend this: https://github.com/blueimp/jQuery-File-Upload . 我建议这样做: https : //github.com/blueimp/jQuery-File-Upload Since, I've used it for my Rails application and it worked just out of the box with no configuration and setting issues. 从那以后,我将其用于Rails应用程序,它开箱即用,没有配置和设置问题。 Try its Demo: http://blueimp.github.com/jQuery-File-Upload/ before you code. 在进行编码之前,请尝试其演示: http : //blueimp.github.com/jQuery-File-Upload/ And in last you may also browse some code written for the same in Rails here: https://github.com/ncri/s3_uploader_example 最后,您还可以在此处浏览一些用Rails编写的相同代码: https : //github.com/ncri/s3_uploader_example

And if you need any kind of help in this. 如果您需要任何帮助。 Do let me know cause, I've just finished working on this stuff and have a fresh context about it right now. 让我知道原因吧,我刚刚完成了这些工作,现在有了一个新的背景。 But I guess you wouldn't need any sort of help if, you're a little hacky in nature. 但是我想,如果您本质上有点笨拙,那么您将不需要任何帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM