熊猫错误 - 文件没有上传

时间:2013-03-28 04:42:58

标签: ruby-on-rails-3 pandastream

我正在尝试在我的应用中嵌入视频,并使用宝石熊猫'1.6.0'。我跟着pandastream与rails guide集成,并有以下代码:

  controllers:
  -------------

  class BoothVideosController < ApplicationController
     before_filter :init_booth_video

   def show
    @original_video = @video.panda_video
    @h264_encoding = @original_video.encodings["h264"]
    render :template => 'booth_video/booth_video', :layout => 
                        'sponsored_group_manage_sub_menu'
   end

   def new
     @video = BoothVideo.new
     render :layout => 'sponsored_group_manage_sub_menu'
   end

   def create
     @video = BoothVideo.create!(params[:video])
     redirect_to :action => :show, :id => @video.id 
   end

   def init_booth_video
     @group = Group.find(params[:group_id])
     @video=@group.booth_video
   end
 end


   class PandaController < ApplicationController
       def authorize_upload
         payload = JSON.parse(params['payload'])
         upload = Panda.post('/videos/upload.json', {
         file_name: payload['filename'],
         file_size: payload['filesize'],
        profiles: "h264",
       })
        render :json => {:upload_url => upload['location']}
      end
   end


 model:
 ------
 class BoothVideo < ActiveRecord::Base
   belongs_to :group
   validates_presence_of :panda_video_id

   def panda_video
      @panda_video ||= Panda::Video.find(panda_video_id)
   end
  end


 View
 -----

  <% content_for(:page_title, "Create a New Booth Video") -%>
  <% form_for(:booth_video,:url => group_booth_video_path, :html => {:id => 
                                  "new_booth_video", :multipart => true}) do |f| %>
  <h5>New Booth Video</h5>
  <fieldset>
 <input type="hidden" name="panda_video_id"/>
     <label for="title">Title</label><br />
     <%= f.text_field :title, :size => 32, :placeholder => "Title for the new booth 
                           video" %><br /><br />
    <div class='progress'>
            <span id="progress-bar" class='bar'></span>
    </div>
    <div id="browse">Choose file</div>
    <%=f.submit "Upload video" %>
   <% end %>

我还在我的application.js文件中包含了ps for panda uploader。 我能够看到我的文件上传器但是当我实际浏览并选择一个文件时,它实际上并没有被加载 - 进度条中也没有显示任何进度。

  1. 为什么视频没有上传?
  2. 创建动作在教程中提到了params [:video],但是没有参数 上传视频的“新”表单 - 如何识别?
  3. 请帮忙!提前谢谢......

0 个答案:

没有答案