chris_angell
01-08-2008, 01:24 PM
hello i am creating a xml file using ASP dynamically and when i run the script it works first time and creates the file
but
when the file already exists it creates and error and doesn't write over the previous file.. i am trying to make an admin area where this file can be constanly updated ??
has anyone got any ideas why i can't write over the preious file or any ideas how i can get round this..
here is my code
FmContent = "folder"
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
f=fs.CreateFolder(Server.MapPath("" & FmContent & ""))
set f=nothing
set fs=nothing
CSVTxt = "<?xml version=""1.0"" encoding=""utf-8"" ?>" & vbcrlf & _
"<Artists>" & vbcrlf & _
"<Artists>" & vbcrlf & _
"</Artists>"
AddHtm = "file"
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
Set tsObject = fsoObject.CreateTextFile(Server.MapPath("" & FmContent & "/" & AddHtm & ".xml"))
tsObject.Write CStr(CSVTxt)
Set fsoObject = Nothing
Set tsObject = Nothing
%>
many thanks chris
but
when the file already exists it creates and error and doesn't write over the previous file.. i am trying to make an admin area where this file can be constanly updated ??
has anyone got any ideas why i can't write over the preious file or any ideas how i can get round this..
here is my code
FmContent = "folder"
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
f=fs.CreateFolder(Server.MapPath("" & FmContent & ""))
set f=nothing
set fs=nothing
CSVTxt = "<?xml version=""1.0"" encoding=""utf-8"" ?>" & vbcrlf & _
"<Artists>" & vbcrlf & _
"<Artists>" & vbcrlf & _
"</Artists>"
AddHtm = "file"
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
Set tsObject = fsoObject.CreateTextFile(Server.MapPath("" & FmContent & "/" & AddHtm & ".xml"))
tsObject.Write CStr(CSVTxt)
Set fsoObject = Nothing
Set tsObject = Nothing
%>
many thanks chris