0

I am trying to write a file. I keep getting an error though and I'm not sure what to make of it. Is there anyone who has an suggestions on this. Thanks so much The error:

Warning: fopen(Library/WebServer/Documents/gasDev/test_files/850_855_csv_tests/855_export/GUNB0855.Z9000404): failed to open stream: No such file or directory in /Library/WebServer/Documents/gasDev/src/controller/containerController.php

this is the function I am using:

public function saveFile($saveFile,$content){
    $newFile = fopen($saveFile, 'w');
    fwrite($newFile, $content);
    fclose($newFile);
}//end saveFile()
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
demuro1
  • 289
  • 1
  • 4
  • 15

1 Answers1

2

You cant read or write to a directory which doesnt exist. Code in this answer should be run before trying to open it

PHP: fopen to create folders

Community
  • 1
  • 1
exussum
  • 18,275
  • 8
  • 32
  • 65