简体   繁体   English

如何使用jRecorder和Ruby on Rails将录制的音频文件上传到Amazon S3

[英]How to upload a recorded audio file to Amazon S3 using jRecorder and Ruby on Rails

jRecorder is a jQuery plugin for audio recording ( documentation ). jRecorder是一个用于音频录音( 文档 )的jQuery插件。 The plugin records an audio file using the browser's flash player and saves the file in a browser temporary file and when the user finishes recording, it sends the file as POST to a PHP server (a php file). 该插件使用浏览器的Flash Player录制音频文件,并将该文件保存在浏览器临时文件中,当用户完成录制后,它将以POST的形式将文件发送到PHP服务器(一个php文件)。 However, I would like to modify the plugin to send the file to an Amazon S3 bucket using Ruby on Rails. 但是,我想修改插件以使用Ruby on Rails将文件发送到Amazon S3存储桶。

How would I go about sending the recorded file to [my-amazons3-bucket] in RoR? 如何将录制的文件发送到RoR中的[my-amazons3-bucket]?

Just change the host param in the plugin to point to a rails route that will accept the post. 只需在插件中更改主机参数以指向将接受该帖子的Rails路线即可。 Here is AWS Ruby Gem http://amazon.rubyforge.org/ 这是AWS Ruby Gem http://amazon.rubyforge.org/

So, you would have a controller that would accept the post and then you would simply upload the posted file to your S3 bucket 因此,您将有一个控制器来接受发布,然后只需将发布的文件上传到S3存储桶

You can use Carrierwave with store option Fog. 您可以将Carrierwave与存储选项Fog一起使用。 You will need to initialize your bucket with aws credentials in uploader. 您将需要使用上载器中的AWS凭证初始化存储桶。

 self.storage :fog
    self.fog_credentials = {
      :provider               => 'AWS',
      :aws_access_key_id      => 'youraccesskeyid',
      :aws_secret_access_key  => 'yourawssecretaccesskey',
      :region                 => 'yourbucketregion'
    }
    self.fog_directory = "yourbucketname"

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

相关问题 将文件从客户端上传到Ruby on Rails Server到Amazon S3 - Uploading File from Client to Ruby on Rails Server to Amazon S3 如何在Rails中使用Ajax和Jquery将图像上传到Amazon AWS(S3)? - How to upload an Image to Amazon AWS (S3) using Ajax and Jquery in Rails? 使用 s3_direct_upload gem 的 Rails 6 Amazon S3 错误 POST 403(禁止) - Rails 6 Amazon S3 Error POST 403 (Forbidden) using s3_direct_upload gem 使用Rails 3.2和AJAX(非闪存上传解决方案)将多个文件直接上传到Amazon S3 - Uploading multiple files directly to Amazon S3 using Rails 3.2 and AJAX (non-flash upload solutions) 使用上传到Amazon S3的JQuery文件在客户端调整图像大小 - Resizing image at client-side using JQuery file upload to amazon S3 使用SDK和Uploadify将文件上载到Amazon S3时显示的上载进度不正确 - Incorrect upload progress shown when uploading file to Amazon S3 using SDK and Uploadify 在文件输入异步更改的情况下将图像上载到Amazon S3 - Upload an image to amazon s3 on file input change asynchronously Amazon S3文件上传:抛出403 - Amazon S3 File Upload: throwing up 403 在大小超过3 GB的Amazon S3上上传文件 - Upload file on amazon S3 of size more than 3 gb Amazon S3 CORS POST因JQuery-file-upload而失败 - Amazon S3 CORS POST fails with JQuery-file-upload
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM