I am using Laravel 4.2 and want to make a download response using Response::download
. So I used the following code:
$headers = array(
'Content-Type: application/vnd.android.package-archive',
);
return Response::download(URL::to("assets/install.apk"), "tracking.apk", $headers);
But I got a FileNotFoundException
exception. Then, I found this answer and changed my codes to:
$headers = array(
'Content-Type: application/vnd.android.package-archive',
);
return Response::download(public_path() . "/assets/install.apk", "tracking.apk", $headers);
Now, it works. However, my question is what was wrong with URL::to
?