FSO - HTML file

Results 1 to 4 of 4

Thread: FSO - HTML file

  1. #1
    meeta Guest

    Default FSO - HTML file

    Yes I&#039;ve gone through ASP FAQ. <BR>I&#039;ve one place where read/write is working. In other instance I&#039;ve filename doc1.htm stored in database. For some reason its showing file not found. I do know file is located. Permission has bee given to "FULL". If i do response.write & filename it displays half of the file content as text & not as html<BR><BR>dim fs, fso<BR>filename = rs("prodspec")<BR>set fs=Server.CreateObject("Scripting.FileSystemObject ")<BR>fname = server.MapPath("./")&("admin\")& filename<BR> if fs.FileExists(fname) then<BR> Set fso=fs.OpenTextFile(fname,1,False)<BR> strFileContents = fso.ReadAll<BR> fso.Close<BR> Set fso = Nothing<BR> Response.Write "&#060;font face=arial size=1&#062;" & strFileContents & "&#060;/font&#062;"<BR> else <BR> response.write "File not found"<BR> end If<BR> set fs=nothing<BR><BR>Any help greatly appreciated<BR>Thanks<BR>Meeta

  2. #2
    meeta Guest

    Default RE: clarification of question

    Problem is assinging filename. I&#039;ve filename stored in acces database table. <BR>prodspec = "doc.htm"<BR><BR>filename = rs("prodspec") is not working for whatever tecincial reason.. may be it needs content type or something?<BR>When I tried reading directly <BR><BR>fileanme = "doc.htm" it does display content<BR><BR>My question is how to assing filename from table to file variable to open the file to read content.<BR><BR>I hope someone would answer my question.<BR>Thanks

  3. #3
    Join Date
    Dec 1969

    Default RE: FSO - HTML file

    So *THIS* code:<BR><BR>filename = rs("prodspec")<BR>set fs=Server.CreateObject("Scripting.FileSystemObject ")<BR>fname = server.MapPath("./")&("admin\")& filename<BR><BR>does NOT work, but *THIS* code:<BR><BR>filename = "xyz.doc"<BR>set fs=Server.CreateObject("Scripting.FileSystemObject ")<BR>fname = server.MapPath("./")&("admin\")& filename<BR><BR>*DOES* work. Is that right?<BR><BR>Well, then, I would say you simply don&#039;t have a valid filename stored in that field in your DB, no matter what you may think.<BR><BR>Time to DEBUG DEBUG DEBUG.<BR><BR>filename = rs("prodspec")<BR>Response.Write "&#060;HR&#062;The filename from the DB is: [" & filename & "]&#060;HR&#062;"<BR><BR>And if the name *looks* good (no spaces in it, for example, then *still* go into the browser and do "View &#124 Source" and see if, perhaps, there is a NEWLINE character in the name or or or.<BR><BR>You seem to be trying to make things too complicated. There is *NO DIFFERENCE* in how FSO works with a name, no matter whether you get it out of a record set, type it in by hand, or generate one at random from the letters in your alphabet soup. A name is a name is a name. Period. But spaces and newline characters and other things *do* change the name, you know.<BR><BR><BR><BR>

  4. #4
    Meeta Guest

    Default RE: its working

    there was a space with filename..!thanks as always

Posting Permissions

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