Cant write file to server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Newbie with Kiwiwebhost and LAMP with PHP 4.XX

Trying to iron out my first "file upload" issues. Using "Build your
own database driven websites: using PHP and MySQL" and the online
manual as main resources.

I cannot write out a file to my public_html directory. I have trimmed
this down to the bare minimum.

/*PHP*********************/
$destfilename = 'hello.txt';
$outputdata = 'Hello World!';

$destfile = fopen($destfilename, 'w');
if (!$destfile) {
  exit ('Unable to open file for writing');
}
fwrite($destfile, $outputdata);	
fclose($destfile);
echo 'Success';
/*EOF**********************/

In theory with relative addressing it should save the data to a file in
the same directory as the script (according to kiwiwebhost). Also they
say they do not block 'fopen'/'fwrite'. 'fread' works fine from the
temporary uploadfile.

I get this error...
Warning: fopen(hello.txt): failed to open stream: Permission denied in
/home/mbadams/public_html/rentals/fileupload.php on line 4.

Also tested:
.jpg for output file
copy function raises same error
absolute addressing
fopen ($destfilename, 'x');

I gotta be missing something simple here.

Don't ping me for the text file write. I will be using jpegs in
production. A simple text helps minimise my example.

TIA
-- 
Michael

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux