Reputation: 385
i want to create download excel function using laravel-excel.maatwebsitelibrary. my code like below :
return Excel::download(new PembukuanExport, 'pembukuan.xlsx');
but when i ran it, it gave me error like this
Could not open /var/folders/n_/xh_10hm50dvbwg23cfq_kw3h0000gn/T/laravel-excel-DMBN3reNUrSiamYT for writing.
my laptop is macbook, been googling but cant find the right answer
Upvotes: 0
Views: 3459
Reputation: 6276
It might be too late to answer this, but I guess you need to configure your excel.php
config files.
Publish excel config files:
php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider"
Now in config/excel.php
files you need to do configuration:
'temporary_files' => [
/*
|--------------------------------------------------------------------------
| Local Temporary Path
|--------------------------------------------------------------------------
|
| When exporting and importing files, we use a temporary file, before
| storing reading or downloading. Here you can customize that path.
|
*/
'local_path' => storage_path(),
/*
|--------------------------------------------------------------------------
| Remote Temporary Disk
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup with queues in which you
| cannot rely on having a shared local temporary path, you might
| want to store the temporary file on a shared disk. During the
| queue executing, we'll retrieve the temporary file from that
| location instead. When left to null, it will always use
| the local path. This setting only has effect when using
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
],
This will set the temporary folder to your storage path which has permission to execute things. Hope this find helpful to others.
Upvotes: 6
Reputation: 385
i solved this by changing User & Group
in `httpd.conf.
httpd.config
.User your_mac_user
and fill in Group staff
Upvotes: 4