Fixed file uploads to media streams

This commit is contained in:
Matias Griese
2018-05-22 10:58:35 +03:00
parent ee8e4886ad
commit 08075979c1
3 changed files with 11 additions and 4 deletions

View File

@@ -1687,9 +1687,16 @@ class AdminController extends AdminBaseController
return false;
}
/** @var UniformResourceLocator $locator */
$locator = $this->grav['locator'];
$path = $media->path();
if ($locator->isStream($path)) {
$path = $locator->findResource($path, true, true);
}
// Upload it
if (!move_uploaded_file($_FILES['file']['tmp_name'],
sprintf('%s/%s', $media->path(), $_FILES['file']['name']))
sprintf('%s/%s', $path, $_FILES['file']['name']))
) {
$this->admin->json_response = [
'status' => 'error',