Jump to content

[SOLVED] How to create a file in a specific directory?


ballhogjoni

Recommended Posts

Maybe try this:

 

<?php
if (file_exists('local/path/to/file/test.csv')) {
   echo 'The file exists...grabbing the contents<br />';
   $file = file_get_contents('local/path/to/file/test.csv');
   echo nl2br($file);
   echo '<br />End of the file!';  
}else {
   $fh = fopen('local/path/to/file/test.csv','w');
   fwrite($fh,$csv_output);
   fclose($fh);
}
?>

 

And see what that displays. It may be writing it but for whatever reason you cannot see it??

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.