首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > 其他 > rails_ajax_upload

rails_ajax_upload

  • 资源大小:108.27 kB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:1次
  • 资源积分:1积分
  • 标      签:

资 源 简 介

Normally, to upload file,we will write some codes in the view page like: <% form_for(:photo, :url => {:action => :create}, :html => { :multipart => true}) do |form| -%> Upload A Image:remote\_form\_for(:photo, :url => {:action => :create}) do |form| -%> > Upload A Image: end -%> Now, file upload will post via a iframe without refresh the page. But how about the rjs? We won"t forget it. Add some codes in the controller as bellow: 1. iframe request > if params[:HTTP\_X\_REQUESTED\_WITH] && request.post? > > render :template => "photos/create.rjs", :layout => false, :content\_type => "text/html" > else 1. normal request > > respond\_to do |format| > > > format.html {redirect\_to :action => "new", :id => @photo if request.post?} > > > format.js > > end > end Now we can render different views by the request type automatically.

文 件 列 表

photo_upload
vendor
plugins
attachment_fu
test
fixtures
files
fake
tmp
sockets
script
server
README
Rakefile
public
stylesheets
log
lib
tasks
doc
README_FOR_APP
db
migrate
config
environments
components
app
views
photos
.project
vendor
plugins
attachment_fu
test
processors

相 关 资 源

您 可 能 感 兴 趣 的

同 类 别 推 荐

VIP VIP
0.173380s