php - Can't write txt-file on server | not within allowed path(s) -


i'm having trouble writing file in private folder on school's server. i've heard problem rights. or code? believe folders location correct. few errors:

1    $testfile = "schoolserver/test.txt"; 2            3           if (!file_exists($testfile))  4           { 5               $fileoperation = "a"; 6               $test = preg_replace( '/\h+/', ' ', $test); 7               $file = fopen ($testfile, $fileoperation); 8               fwrite ($file, $week . "\r\n" . $test . "\r\n" . "\r\n"); 9               fclose ($file); 10          } 

warning: file_exists(): open_basedir restriction in effect. file(test.txt) not within allowed path(s): (d:\sitestemp) in d:\register-test.php on line 3

warning: fopen(): open_basedir restriction in effect. file(test.txt) not within allowed path(s): (d:\sitestemp) in d:\register-test.php on line 7

warning: fopen(test.txt): failed open stream: operation not permitted in d:\register-test.php on line 7

warning: fwrite() expects parameter 1 resource, boolean given in d:\register-test.php on line 8

warning: fclose() expects parameter 1 resource, boolean given in d:\register-test.php on line 9

thanks!

it seems fopen fails, should test returns :

$file = fopen($testfile, $fileoperation); if ($file) {     fwrite($file, $week . "\r\n" . $test . "\r\n" . "\r\n");     fclose($file); } 

also, seems file located in place php can't open it, see here


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -