Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can be creating or viewing a file that hard?

Status
Not open for further replies.
Nov 16, 2002
24
US
Anybody has any idea why even the code I got from ASP book is not working? Problem is always the same: page gets stuck.
Is it because XP has issue with Norton AntiVirus software?
I can't uninstall Norton from my computer though, any ideas?

Code for creating a file:
********************************************************
dim filesys, filetxt, getname, path
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.CreateTextFile("c:\somefile.txt", True)
path = filesys.GetAbsoultePathName("c:\somefile.txt")
getname = filesys.GetFileName(path)
filetxt.WriteLine("Your text goes here.")
filetxt.Close
if filesys.FileExists(path) Then
Response.Write ("Your file, " & getname & ", has been created.")
End if

**************************************************
Here is the code for viewing a file:

<%
' File System Object
Dim fso
Set fso = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)

' &quot;Uploaded&quot; Folder
Dim folder, idpath
idpath = Session(&quot;id&quot;)
'Set folder = fso.GetFolder(Server.MapPath(&quot;idpath/&quot;))

If folder.Size > 0 Then
Response.Write &quot;<ul>&quot; & idpath
'For Each file In folder.Files
' Response.Write &quot;<li type=&quot;&quot;circle&quot;&quot;>&quot;
' Response.Write &quot;<a href=&quot;&quot;idpath/&quot; & file.Name & &quot;&quot;&quot;>&quot;
' Response.Write &quot;<b>&quot; & file.Name & &quot;</b></a>&quot;
' Response.Write &quot;( Size: &quot; & file.Size & &quot; )&quot;
'Next
Response.Write &quot;</ul>&quot;
Else
Response.Write &quot;<ul><li type=&quot;&quot;circle&quot;&quot;>No Files Uploaded.</ul>&quot;
End If
%>



Thanks guys!
 
You don't actually need to remove norton, only disable the scripting protection so that it will allow you to access the filesystemobject. I would tell you where it is in Norton, bu the lack of coffee is keeping me from finding it :p

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Hi, Tarwn

Finally, after so many hours working.......

Thaaaaaaaaaaaaanks so much!
 
No problem, i think i have that solution memorized now, i remember the feeling to this day when I was trying to get it working on my machine :)

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top