Opening a newly created file. 
Author Message
 Opening a newly created file.

I can have my Perl CgI create and write to a new file, but can't read
it unless I chmod the new file through telnet. Can I have my Perl CGI
create AND allow me to read the file?

Thanks much.



Tue, 10 Apr 2001 03:00:00 GMT  
 Opening a newly created file.

Try

chmod 0755, $filename
or
chmod 0755, 'myfile.txt'

Quote:

> I can have my Perl CgI create and write to a new file, but can't read
> it unless I chmod the new file through telnet. Can I have my Perl CGI
> create AND allow me to read the file?

> Thanks much.


  shjmoore.vcf
< 1K Download


Tue, 10 Apr 2001 03:00:00 GMT  
 Opening a newly created file.
How are you opening it?  Show us some code...

Typically, when you run CGI programs, they run as whatever user the web
server is set up to run as.  When you create a file, it will create one
with the permission of THAT user.

Have you tried opening the file in WRITE mode, and then sending data to
it?  Try this snippet:

open (HANDLE,">filename.txt") || die "There was an error opening the
file $!\n";
print HANDLE "Print this in the file...\n";
close(HANDLE);

and see if you have entered anything into the file...

HTH,
brent
--

           Brent Michalski            
        -- Perl Evangelist --          

Resume: http://www.inlink.com/~perlguy



Tue, 10 Apr 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. how to substitute strings in a newly created file

2. Opening/creating files

3. Open or Create a file

4. Did an open for append create the file?

5. can't seem to open or create a file

6. creating and opening a file

7. Opening file handle for create??

8. OPEN to create a file == Permissions problem!!

9. open FILE,$path || open FILE,$altpath;

10. Problems with labels in newly compiled perl

11. Getting id for MSSQL2000 newly inserted record

12. download new module in newly installed linux

 

 
Powered by phpBB® Forum Software