0
我正在開發一個將被android和iOS設備使用的API堆棧。應該使用一種API方法從服務器下載圖像。我使用followng代碼來啓動下載,但是當我使用Hurl進行測試時,該方法永遠返回0字節。Laravel 5.1,使用REST下載圖像Api
if(file_exists($file)) //$file contains absolute path
{
EventLogger::info('##### Downloading the file#### ');
$filename = basename($file);
$headers = array('Content-Type: image/png');
response()->download($file,$filename,$headers);
}
在routes.php文件我有
Route::get('files/downloadimage/{cardid}', ['middleware'=>'jwt.auth', 'uses' => '[email protected]'])->name('files.download');
請讓我知道如果我做錯什麼。
謝謝。傻我。 – logeeks