- composer updates

- consistent repository identifier in OAI requests
- open default formats in browser
- open files in new tab
This commit is contained in:
Arno Kaimbacher 2020-04-16 22:29:26 +02:00
parent 17fcdec50e
commit 8208558e8c
4 changed files with 48 additions and 54 deletions

View file

@ -2,8 +2,8 @@
namespace App\Http\Controllers\Settings;
use App\Http\Controllers\Controller;
use Illuminate\View\View;
use Illuminate\Http\Request;
// use Illuminate\View\View;
// use Illuminate\Http\Request;
use App\Models\File;
class FileController extends Controller
@ -14,7 +14,24 @@ class FileController extends Controller
$file = File::findOrFail($id);
$file_path = public_path('storage/' . $file->path_name);
$ext = \Illuminate\Support\Facades\File::extension($file_path);
return response()->download($file_path, $file->label . "." . $ext, ['Content-Type:' . $file->mime_type]);
// return response()
// ->download(
// $file_path,
// $file->label . "." . $ext,
// ['Content-Type:' . $file->mime_type],
// 'inline'
// );
$pdf = $file->label . "." . $ext;
$download_file = \Illuminate\Support\Facades\File::get($file_path);
return response()->file($file_path, [
'Cache-Control' => 'no-cache private',
'Content-Description' => 'File Transfer',
'Content-Type' => $file->mime_type,
'Content-length' => strlen($download_file),
'Content-Disposition' => 'inline; filename=' . $pdf,
'Content-Transfer-Encoding' => 'binary'
]);
// return response()->download($file_path, $file->label, ['Content-Type:' . $file->mime_type]);
}
}