Delete a file from the server

Hi all,

i want to create a vcs file. when i am creating the vcs file it is
getting creatd in the server as well as in the local drive. But i dont
want to the vcs file to be saved in the serve. when i am trying to
delete the file from the server it is throwing the error,“Cannot start
Microsoft Outlook.Cannot import vCalendar file”. here is the code that i
am using.

def vcs
f = File.open(“txt_name.vcs”,“w+”)
f.syswrite(“BEGIN:VCALENDAR\n”)
f.syswrite(“PRODID:-//Microsoft Corporation//Outlook MIMEDIR//EN\n”)
f.syswrite(“VERSION:1.0\n”)
f.syswrite(“BEGIN:VEVENT\n”)
f.syswrite(“DTSTART:20070105T210000Z\n”)
f.syswrite(“DTEND:20070105T230000Z\n”)
f.syswrite(“LOCATION:My office\n”)
f.syswrite(“CATEGORIES:Business\n”)
f.syswrite(“DESCRIPTION;ENCODING=QUOTED-PRINTABLE:This is a note
associated with the meeting\n”)
f.syswrite(“SUMMARY;ENCODING=QUOTED-PRINTABLE:Meeting to discuss
something unwanted !!\n”)
f.syswrite(“PRIORITY:3\n”)
f.syswrite(“END:VEVENT\n”)
f.syswrite(“END:VCALENDAR\n”)

f.close

#value=StringIO.open("txt_name.vcs")


 send_file File.ree'txt_name.vcs', :type => 'text/x-vCalendar',

:disposition => ‘attachment’

if(File.exists?("txt_name.vcs"))
File.delete("txt_name.vcs")
end

end

plz do help me out. thanks in advance.
regards,
john.

 send_file File.ree'txt_name.vcs', :type => 'text/x-vCalendar',

:disposition => ‘attachment’

Just a guess…

Looks like your script is dieing when it tries to open the vcard in
outlook, therefore doesn’t get to the delete action.

Your delete file code looks right.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs