|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Can I use FileSystemObjects to Read Text Files on my server rather than just on my local drive?
D# ![]() |
|
#2
|
|||
|
|||
|
Yes, if the web server user account has proper permissions to read the file.
|
|
#3
|
||||
|
||||
|
I used a piece of code the following code off 4guys:
Code:
<%
' Read from test file
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Dim objTextStream
const strFileName = "/oak/test.txt"
const fsoForReading = 1
If objFSO.FileExists("/oak/test.txt") then
'The file exists, so open it and output its contents
Set objTextStream = objFSO.OpenTextFile(strFileName, fsoForReading)
Response.Write "" & objTextStream.ReadAll & ""
objTextStream.Close
Set objTextStream = Nothing
Else
'The file did not exist
Response.Write strFileName & " was not found."
End If
'Clean up
Set objFSO = Nothing
%>
Quote:
- D# |
|
#4
|
||||
|
||||
|
I tried this code on a brinkster accont and gave me the same error!
BTW, i have no idea of the FSO is enabled, as i'm using a shared server through a hostings company! Help NEEDED!! - D# |
|
#5
|
|||
|
|||
|
It sounds like the FSO is removed on your web server. This is not uncommon with windows hosts, some ISP's don't take the time to properly configure permissions and the FSO can be a security risk.
Check with your host. |
|
#6
|
||||
|
||||
|
Is there any other way of doing what i need to do without FSO?
- D# |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > FileSystemObject to Read Text Files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|