i want to create a .txt file with laravel 4 and upload it to my server like PHP does, and also i need to create a JSON file with laravel 4 and upload it to my server.
Thanks for your help!
To use the filesystem of Laravel, you should access it through the File
Facade.
Create a new file:
//Usage
File::put($path,$contents);
//Example
File::put('web/text/mytextdocument.txt','John Doe');
Delete a file:
//Usage
File::delete(string|array $paths)
//Example
File::delete('web/text/mytextdocument.txt');
The complete documentation on all available methods is found here: https://laravel.com/api/4.2/Illuminate/Filesystem/Filesystem.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With