rodavid5
rodavid5

Reputation: 15

Could not create file Using PHP code

On the 000webhost.com server

This is the code

<?php
$my_file = fopen("my_test.txt", 'w');

fclose($my_file );

I thank those who help me in advance

Upvotes: 1

Views: 46

Answers (1)

Sourabh
Sourabh

Reputation: 157

Use the function chmod https://www.php.net/function.chmod

$file = "my_test.txt";
$fp = fopen($file, 'w');
fwrite($fp, $content);
fclose($fp);
chmod($file, 0777); 

Note* fwrite is optional in your case if you need to enter some data in file

Upvotes: 1

Related Questions