直接貼Code好不好? 噗!
Controller:
def uploading
    files = []
    for i in 1..session[:files].to_i
      next if  params[:gallery]["file_#{i}".to_sym].to_s.blank?
      files << Gallery.create(:file => params[:gallery]["file_#{i}".to_sym]).id.to_s
    end
    redirect_to :action => "images", :files => files.join("_")
  end
 
  def new_upload_field
    session[:files]+=1
    render :update do |page|
      page.insert_html :after, "file_fields", file_column_field("gallery", "file_#{session[:files]}") + "<br />"
    end
  end

hechian 發表在 痞客邦 留言(3) 人氣()

Rails中有個安全性漏洞,請參考
* http://manuals.rubyonrails.com/read/chapter/47
* http://www.javaeye.com/topic/58686
假設我們有個users table,表格欄位如下:

hechian 發表在 痞客邦 留言(0) 人氣()

1
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。