簡體   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