From: Amit Tomar Date: 2010-10-20T22:50:43+09:00 Subject: Re: Messagebox on client side Thanks jermy for your response ,this is something i want to achive .In my application am uploading file to a folder but file is already there it would ask for overwrite by displaying messagebox but problem i already told .Could you suggest some other way to achieve this means i don;t know much about javascript .can we send desktop of one machine to other?? require 'dl' # button constantsBUTTONS_OK = 0 BUTTONS_OKCANCEL = 1 BUTTONS_ABORTRETRYIGNORE = 2 BUTTONS_YESNO = 4 CLICKED_CANCEL = 2 CLICKED_ABORT = 3 CLICKED_RETRY = 4 CLICKED_IGNORE = 5 CLICKED_YES = 6 CLICKED_NO = 7 class UploadController < ApplicationController def index render :file => 'app\views\upload\uploadfile.rhtml' end def message_box(txt, title=APP_TITLE, buttons=BUTTONS_OK) user32 = DL.dlopen('user32') msgbox = user32['MessageBoxA', 'ILSSI'] r, rs = msgbox.call(0, txt, title, buttons) return r end def uploadFile name=DataFile.save1(params[:upload]) puts name $t=0 k = [] File.open("d:/dm/aan.txt").each do |line| k << line.chomp end puts k #puts line.size $s=k.size #puts $s for i in 0..Integer($s) if $L=(name.eql?(k[i]) == true) response = message_box("Are you sure you want to OVERWRITE", "Proceed?", BUTTONS_YESNO) if response == CLICKED_YES post = DataFile.save(params[:upload]) render :text => "File has been uploaded successfully" else render :text => "File cann't successfully" end end end end end -- Posted via http://www.ruby-forum.com/.