SiavashBamshadnia / Laravel-Source-Encrypter

Laravel and Lumen Source Code Encrypter
MIT License
535 stars 124 forks source link

File not found exception #6

Closed hackerkok closed 4 years ago

hackerkok commented 4 years ago

I got a file not found exception when running the code: ErrorException : file_put_contents(/var/www/......php): failed to open stream: No such file or directory

The issue can be solved by creating the folders before writing to the files:

$cipher = bolt_encrypt($fileContents, $key);
File::isDirectory(dirname("$destination/$filePath")) or File::makeDirectory(dirname("$destination/$filePath"), 0755, true, true);
File::put(base_path("$destination/$filePath"), $prepend.$cipher);

Keep up the good work!