I added a custom field (multiple files) in the pages. I added files and saved. No problem, but when I want to attach a new file, old files remove
Steps to reproduce the behavior:

for fix you can change the method insertUpdateData()
vendor/tcg/voyager/src/Http/Controllers/Controller.php
insertUpdateData() {
/*
* merge ex_images and upload images
*/
if (($row->type == 'multiple_images' || $row->type == 'files') && !is_null($content)) {
if (isset($data->{$row->field})) {
$ex_files = json_decode($data->{$row->field}, true);
if (!is_null($ex_files)) {
$content = json_encode(array_merge($ex_files, json_decode($content)));
}
}
}
}
Hey. Would you mind to make a PR with this solution?
i have this problem to. But you don't right. If you have the same problem, you need change "files" to "file" in your comment. So you get that:
if (($row->type == 'multiple_images' || $row->type == 'file') && !is_null($content)) {
if (isset($data->{$row->field})) {
$ex_files = json_decode($data->{$row->field}, true);
if (!is_null($ex_files)) {
$content = json_encode(array_merge($ex_files, json_decode($content)));
}
}
}
if you want solve the problem right now, you need:
'controllers' => [
'namespace' => 'App\Http\Controllers\Voyager',
]
Then run php artisan voyager:controllers, Voyager will now use the child controllers which will be created at App/Http/Controllers/Voyager
in file App\Http\Controllers\Voyager\VoyagerBaseController.php copy 3 functions:
1) "update" from TCG\Voyager\Http\Controllers\VoyagerBaseController.php
2) "store" form TCG\Voyager\Http\Controllers\VoyagerBaseController.php
3) "insertUpdateData" from TCG\Voyager\Http\Controllers\Controller.php
In file App\Http\Controllers\Voyager\VoyagerBaseController.php change function "insertUpdateData"
change line
if ($row->type == 'multiple_images' && !is_null($content))
to
if (($row->type == 'multiple_images' || $row->type == 'file') && !is_null($content))
Hello! You can use type «File» to load multiple files, but bug in issue an exist in this method.I wrote step by step how you can fix problem without update Voyager.
Четверг, 14 ноября 2019, 6:46 +10:00 от Mikael Giacomini notifications@github.com:
Hi, I am not sure if this issue is related, probably not, but I cannot find the multiple files type at all in my bread:
Did I understand wrongly the meaning of the issue or it is something completely different? Sorry and thank you!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub , or unsubscribe .
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.