I have form for image upload. After uploading the image with title i store the image in a directory. Instead storing the image name & title into database table i want to store that information into a .json file as same as a record goes to a table of database.
1 Answer
You can take the benefit of File Storage functions in Laravel
use
use Illuminate\Support\Facades\Storage;
and then
$data = [
"name" => $image_name,
"title" => $image_title
]
Storage::disk('public')->put('images.json', json_encode($data));
and this file will be save in public folder
References: