繁体   English   中英

swfupload 406不可接受的错误

[英]swfupload 406 not acceptable error

def create
@asset = Asset.new(params[:asset])

respond_to do |format|
  if params[:Filedata]
    @asset = Asset.new :swf_uploaded_data => params[:Filedata]
    @asset.user = current_user
    @asset.save!

    format.html { render :text => @asset.image.url(:thumb) }
    format.xml  { render :nothing => true }

  else
    if @asset.save
      flash[:notice] = 'Created'
      format.html { redirect_to(@asset) }
      format.xml  { render :xml => @asset, :status => :created, :location => @asset }
    else
      format.html { render :action => "new" }
      format.xml  { render :xml => @asset.errors, :status => :unprocessable_entity }
    end
  end
end
end

我正在使用swfupload创建一个上传状态栏。 上传结束时,出现406错误。

不一定是您的答案,但Plupload遇到了同样的问题,并且请求格式为nil。 这可能不是最好的方法,但是可以执行以下操作:

request.format ||= :xml

为了在方法中提供一些默认格式。 希望它可以帮助别人。

暂无
暂无

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

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