|
-
Dec 7th, 2000, 10:49 AM
#1
Thread Starter
New Member
I have to access a file located in the public folders.
How can i do this in the easieest way? The path is always the same (it is in an outlook form). First i have to read from it, then i have to write to it. Can i eventually also use read only rights while editing it, so that when others try to write to it, when another one is writing to it, that that won't work?
Thanx 4 helping me.
[Edited by mgeerkens on 12-08-2000 at 02:24 AM]
-
Dec 7th, 2000, 11:38 AM
#2
Fanatic Member
what type of file is it, and are you trying to this in ASP ?
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Dec 8th, 2000, 02:25 AM
#3
Thread Starter
New Member
I am not trying this in ASP, just in VBscript from the form.
It is a small txt-file with 2 numbers in it one is a counter which has to be increased.
Thanx again
-
Dec 8th, 2000, 04:11 AM
#4
Fanatic Member
all you need is the following code
<script language="VBSCRIPT">
Sub OpenTextFileTest
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
f.Write "Hello world!"
f.Close
End Sub
</SCRIPT>
the above code will open a file on the clients machine
if you want to open a file on the server use the following
<script language="VBSCRIPT" RUNAT="SERVER">
Sub OpenTextFileTest
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
f.Write "Hello world!"
f.Close
End Sub
</SCRIPT>
if that doesn't work, then i think you need to do it in asp
hope this helps
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Dec 8th, 2000, 04:26 AM
#5
Thread Starter
New Member
Could you tell me someting more about
ASP?
And i know how to do that on a local machine, but if i have to open the file from the public folders, so there is no c:\dirname in it....
Thanx again!!
-
Dec 8th, 2000, 04:37 AM
#6
Fanatic Member
ASP - or active server pages is a way of dynamically creating pages on the fly and all the code that writes it is normally in vbscript. all the pages are created on the server and the client see's the end result. where you say the files are in public folders, do you meen their on virtual directories on the web server or on public folders on a network domain
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Dec 8th, 2000, 04:52 AM
#7
Thread Starter
New Member
it is a public folder on the Server. It is not a web server, so i think it is the one on the network domain.
If you are browsing in the public folders and you ask the properties of the folder where the file is in you can see the location like : \firstsubdir\secondsubdir\knowledgebase
Thanx again
-
Dec 8th, 2000, 04:56 AM
#8
Fanatic Member
in that case give this a go
<script language="VBSCRIPT" RUNAT="SERVER">
Sub OpenTextFileTest
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("\\servername\firstsubdir\secondsubdir\knowledgebase\filename", ForWriting, True)
f.Write "Hello world!"
f.Close
End Sub
</SCRIPT>
as you can use relative path's in the opentextfile function
if that doesn't work then you will need to go down the asp route, but if you don't know anything about asp, I can;t really explain how to do it
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|