Page 1 of 1

Create file in separate directory does not work.. Any Ideas?

Posted: Thu Mar 04, 2004 9:24 pm
by idotcom
Hi all

I have a page/script that uses a form to create files on the server.
Everything works great except it will not write/create files to other directories.

It will only create/write files to the same directory, in ( current dir ) only.

So my mission is to be able to have the file creator script in one directory like:

public_html/manager/file_creator.php

And the created files into a directory like:

public_html/userpages/created_file.php

The files and directories perms are fine. even with 777 no luck

I have tried specifying path like:
url path
absolute path
"../userpages/$file_name",
"../userpages/".$file_name,

Nothing worked..

Heres the script.. It works only without specifying path.. like so..

if (!$file_handle = fopen($file_name,"a")) { echo "Cannot open file"; }
if (!fwrite($file_handle, stripslashes($page_content))) { echo "Cannot write to file"; }
echo "You have successfully written data to $page_file_name";
fclose($file_handle);
}

Any input or solutions would be very cool...

Thanks in advance!

Chris