Repo for the search and displace core module including the interface to select files and search and displace operations to run on them. https://searchanddisplace.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
952 B

<?php
namespace App\Http\Controllers;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Storage;
class FileController extends Controller
{
/**
*
* @return JsonResponse
*
* @throws BindingResolutionException
*/
public function create(): JsonResponse
{
$file = request()->file('file');
$filename = time() . $file->getClientOriginalName();
$path = Storage::putFileAs('files/', $file, $filename);
return response()->json([
'file' => $file->getClientOriginalName(),
'id' => $filename,
'path' => $path
]);
}
/**
*
* @param string $id
*
* @return JsonResponse
*
* @throws BindingResolutionException
*/
public function get(string $id): JsonResponse
{
return response()->json(['success']);
}
}