ITeye博客

小木屋

PBFox · 共 64 篇文章

ruby on rails 实现多文件的上传

实现把文件上传到服务器,文件名/文件大小/文件的描述 上传到数据库 Application.rb代码如下: # Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base # Pick a unique cookie name to distingu…

2007-05-22 10:52 · 评论(0)

动态改变字体大小

<script> function ChangeSize(size) { document.getElementById('fID').style.fontSize=size+'px'; } </script> <div id="textSize"> <font size="1" style="cursor:pointer" color="#551A8B" onClick="ChangeSize('10');">小</font> <font size="2" style="cursor:pointer" color="#551A8B" onClick="ChangeSize('12');">…

2007-05-11 16:17 · 评论(0)

ruby on rails 实现文件的下载

Controller: 把这段代码放入 download_controller中 class DownloadController < ApplicationController def download send_file "public/files/"+params[:filename] unless params[:filename].blank? end end View: 把这段代码放入 download.rhtml中 <%=link_to 'download',:action=>'download',:filename=>'trustee070328.zip'%> 这样就可以实现…

2007-05-11 16:02 · 评论(0)

ruby on rails 实现文件的上传

把这段代码放入 Controller 里的 Application.rb class ApplicationController < ActionController::Base # Pick a unique cookie name to distinguish our session data from others' session :session_key => '_upload_session_id' def uploadFile(file) if !file.original_filename.empty? @filename=getFileName(file.original_…

2007-05-11 15:56 · 评论(0)