Open sidebar
if ($url = $request->get('url')) { $path = public_path(self::UPLOAD_PATH); if(!is_dir($path)) { File::makeDirectory($path, 0777, true, true); } $httpClient = new Client(); $response = $httpClient->get( $url, [ RequestOptions::SINK => $path, ] ); if ($response->getStatusCode() === 200) { $record = UploadImage::create([ 'url' => $path, ]); $url = config('app.url') .'/'. $record->url; return response()->file( $url, ['Content-Type' => 'image/png'] ); } }
Close sidebar
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting