mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-05 10:45:31 +02:00
cleanFilesData now returns just the filename
This commit is contained in:
@@ -1012,14 +1012,8 @@ class AdminController
|
||||
}
|
||||
|
||||
if (move_uploaded_file($tmp_name, "$destination/$name")) {
|
||||
$path = $page ? $this->grav['uri']->convertUrl($page, $page->route() . '/' . $name) : $destination . '/' . $name;
|
||||
$cleanFiles[$key][$path] = [
|
||||
'name' => $file['name'][$index],
|
||||
'type' => $file['type'][$index],
|
||||
'size' => $file['size'][$index],
|
||||
'file' => $destination . '/' . $name,
|
||||
'route' => $page ? $path : null
|
||||
];
|
||||
$path = $page ? $this->grav['uri']->convertUrl($page, $page->route() . '/' . $name) : $destination . '/' . $name;
|
||||
$cleanFiles[$key][] = $path;
|
||||
} else {
|
||||
throw new \RuntimeException("Unable to upload file(s) to $destination/$name");
|
||||
}
|
||||
@@ -1045,7 +1039,7 @@ class AdminController
|
||||
foreach ((array)$_FILES as $key => $file) {
|
||||
$cleanFiles = $this->cleanFilesData($key, $file);
|
||||
if ($cleanFiles) {
|
||||
$obj->set($key, reset($cleanFiles)['name']);
|
||||
$obj->set($key, $cleanFiles);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user