[英]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
I am creating an upload status bar with swfupload. 我正在使用swfupload创建一个上传状态栏。 At the end of the upload I get a 406 error.
上传结束时,出现406错误。
Not necessarily your answer but I had the same problem with Plupload and it happens that the request format is nil. 不一定是您的答案,但Plupload遇到了同样的问题,并且请求格式为nil。 It might not be the best way but one could do the following:
这可能不是最好的方法,但是可以执行以下操作:
request.format ||= :xml
in order to provide some default format in the method. 为了在方法中提供一些默认格式。 Hope it can help others.
希望它可以帮助别人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.