hi guys . anyone know problem where is ? download url not working but any url workes. such as dl , downloads and .... why?
url in web.php not working
i write this code:
$this->get('download' , function(){
echo(111);
});
but this not working and instead of download a zip file . why?
If this is in your routes, do this instaed:
Route::get('download' , function(){
echo(111);
});
@paschal : no my friend . no different . this is like my command.
@ali2535 Ooh I understand now. Are you trying to force a file download?
If yes, Laravel download is bounded with responses, try this instead.
return response()->download($pathToFile);
@paschal : yes my friend my problem is that following url not working. and istead of go to HomeController download a zip file .
Route::get('download' , 'HomeController@download');
@ali2535 What is not working? Is the route not working at all? Or the download method of HomeController not being called?
@paschal : no look at this:
Route::get('download' , function(){
echo(111);
});
above code must print 111 but this download a zip file. very Amazing...
@ali2535 Lmaooo that is very funny. Do you use artisan, run this command and reply with the output.
php artisan route:list
@paschal . yes in route:list show download and app/download i copy all in other projects and works . in this project not working
Post the output of route:list here let me see
@paschal :
| | GET|HEAD | app/download
| |
App\Http\Controllers\HomeController@download | web
|
| | GET|HEAD | bonecms_captcha
| laravel-captcha |
LaravelCaptcha\Controllers\CaptchaController@index |
web |
| | GET|HEAD | bonecms_captcha/html
| |
LaravelCaptcha\Controllers\CaptchaController@html |
web |
| | GET|HEAD | contact-us
| contact-us |
App\Http\Controllers\HomeController@ContactUS |
web |
| | GET|HEAD | download
The output looks incomplete... Although I see app/download and download. Post the complete output
you probably have a download file or folder in your website which is being picked up instead of your route.
@Snapey Is every request not passed through Laravel's URI Router first?
@pascal .htaccess first checks if there is a path to the requested object and if not then it rewrites the request to pass it to index.php.
This is how images, css and js are loaded direct without going through the framework
@paschal : complete route is very much. it is big project and very route is in route:list. download and app/download are in route list.
@Snapey : yes i have a apk file that when i type mysite.com/app/download it is correct and download file but when type mysite.com/download it download zip file (download and app/download refer to one function). (i havent zip file) . even i write in web.php
Route::get('download' , function(){
dd(11);
});
above code also download zip file. i dont understand
but do you have a download file or folder in the document root folder ?
The location of this will depend if you have something stupid like /public/ in your URLs
I believe he definitely has a download folder in document root
Please or to participate in this conversation.