Problem creating text file

Results 1 to 2 of 2

Thread: Problem creating text file

  1. #1
    Join Date
    Dec 1969

    Default Problem creating text file

    Hi, i have the following function in my COM object:<BR><BR>Public Function SaveTestToFile(username As String, filecontent As String, filename As String, schoolname As String, testtitle As String, creator As String) As Long<BR><BR> Set fs = CreateObject("Scripting.FileSystemObject")<BR> If Not fs.FileExists(filename) Then<BR> Set a = fs.CreateTextFile(filename, True)<BR> a.writeline (schoolname)<BR> a.writeline (testtitle)<BR> a.writeline (creator)<BR> a.writeline (filecontent)<BR> a.Close <BR> Set a = Nothing<BR> SaveTestToFile = SUCCESS <BR> Else<BR> SaveTestToFile = FAILURE <BR> End If<BR> Set fs = Nothing<BR>End Function<BR><BR><BR>and here is the code calling from a ASP file:<BR><BR>Set AristoObj = Server.CreateObject("prjAristo.clsAristo")<BR><BR> filePath=Server.MapPath("..Uploadpublic\"& session("User") &" "& request.form("fileN") &"")<BR><BR>username=session("User")<BR>response.w rite username<BR><BR><BR>retV=AristoObj.SaveTestToFile( trim(username), trim(session("RandomQuestions")), trim(filePath), trim(request.form("school")), trim(request.form("testTitle")), trim(request.form("creator")))<BR><BR>if retV &#060;&#062; 1 then<BR>response.write "The file name is already exists!, Please rename it"<BR>end if<BR>set AristoObj=Nothing<BR><BR><BR><BR>with above coding, the page just keep loading but does nothing, i tried to do nothing in my COM object and just return what I pass it works, all the value are correctly passed into COM......just don&#039;t know why it can not create the file successfully....please help if anyone knows the problem....<BR><BR><BR>thanks<BR><BR>Frankie<BR><B R>

  2. #2
    Join Date
    Dec 1969

    Default RE: Problem creating text file

    Response.write out your filePath variable... maybe it&#039;s not being filled in the way you think.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts