Hi Lars,
Yes, in general, that should work. Anything that you
can do in a normal Perl program, you can also do in
your CGI script. It will have a direct access to the
server's file system ( NOT client's !).

However, there are several things that you should be 
careful about:
1. Your CGI script needs to have the "writing" permissions
to the directory/file that you are trying to write.
That would be up to your Web server configuration.
And of course, it needs to "see" your mapped drive.
This may or may not be the case depending of the 
"NT user" whose account is used to execute your CGI
sctipts.

2. You should never use the remote-user-supplied file name
for any file operations on your server. This is a
security hole.

3. If you expect your script to be executed by more
than one user at a time, you need to consider the proper 
locking/unlocking of the file. This is to prevent it from being 
over-written by a concurrent process.

4. When writing directory paths under Windows, do not
forget to double your backslashes:

        ">M:\\somepath\\textfile", not ">M:\somepath\textfile"

And better yet, use Perl/Unix notation:

        ">M:/somepath/textfile"

Yes, it will work in ActiveState Perl.
Hope that helps,
Eugene Haimov

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:extern.Lars.Oeschey@;audi.de]
Sent: Tuesday, November 05, 2002 6:18 AM
To: [EMAIL PROTECTED]
Subject: accessing local files from cgi


Hi,

I have a question regarding a cgi I'm about to write. The cgi shall take
some user entries from a form and write them into a text file on a mapped
network drive. Is there any possible way to do that? I would think that if I
do a 
open OUTFILE, ">M:\somepath\textfile"
the server would use it's M: drive instead of the clients one...

Lars
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to