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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing a File to a Different Directory

Status
Not open for further replies.

chitownclone

Programmer
Mar 30, 2004
22
0
0
US
This is a simple issue, but I can't seem to figure out what I am doing wrong. I build an administration page that let's my client add new Loan Officer contact information. The admin program automatically generates an updated 'contact_us.html' page.

My problem is that I can only get the program to write a new 'contact_us.html' file to the cgi-bin directory. Its works, I just want the file in the main directory. How do I get a program in the cgi-bin to write a file to the main diretory?

open (DATA, ">C:/Websites/sitename.com/contactus.html");
print DATA "$variables\n";
Close (DATA);

I've tried chmod and.....
opendir(CONTACT, "C:/Websites/sitename.com/contact")...
but its not working.

Thanks for the assistance.

 
open (DATA, ">path to where you want your file to go");
 
open (DATA, ">path to where you want your file to go");
--------------------------------------------

I've tried that, but unless the directory is

/cgi-bin/file.txt
-or-
/cgi-bin/folder/file.txt

...it doesn't work. For the program to successfully write the file, the directory has to be the main cgi-bin directory or a subdirectory within the cgi-bin folder.

I want it in the main diretory along with index.html, but can't get it work. Is this a permission setting, programming error or what that is keeping me from writing to non-cgi-bin directories??

Thanks.
 
Maybe a relative path:
../../Websites/sitename.com/contactus.html

Add in enough ../s for deeper directories.

--Chessbot

"So it goes."
Kurt Vonnegut, Slaughterhouse Five
 
Nope, I have the relative pathway traced all the way back to the C drive.

C:/Websites/sitename/sitename.com/contact_us.html

The only difference in it working or not is if I point it to the cgi-bin or outside the cgi-bin.

C:/Websites/sitename/sitename.com/contact_us.html (Doesn't Work)

C:/Websites/sitename/sitename.com/cgi-bin/contact_us.html (Works)
 
what flavo(u)r on windows are you on?
sounds like a permissions issue

--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ... smack the fecker
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top