Jump to content

fopen() function does not create a new file


dsaba

Recommended Posts

i'm using this line of code:

 

<?php
$lang = "he";
$text = "whatever\n";
$handle = fopen("/home/www/website.host.com/folder/".$lang."translations.php", "w") or die('Cannot open file');
fwrite($handle, $text) or die('Cannot write to file');
fclose($handle) or die('Cannot close file');
?>

 

it does not error, so it doesn't say "cannot open file"

the file does not exist on my server, i am attempting to create it with "w"

which supposedly should create the file if it doesn't already exist

 

well it DOESN'T and it still doesn't error?

How do I make it create a file if it doesn't exist??

 

Thank you

Are you even referencing the correct folders?  Try uploading a test document, and try doing an fopen using the same folder reference that you have there...except just take out the variable and replace it with the language folder in which you placed your test file.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.