上传的文件支持替换访问域名

This commit is contained in:
Jerry Yan 2024-09-16 13:07:35 +08:00
parent 70e24bb521
commit f312e29d6f

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use http\Url;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Storage;
@ -19,6 +20,7 @@ class FileController extends BaseController
}
$path = $request->file("file")->store("lubo_file");
$full_path = Storage::url($path);
$full_path = str_replace(env("AWS_ENDPOINT"), env("AWS_ACCESS_DOMAIN"), $full_path);
return $full_path;
}
}