Open avvie opened 7 years ago
this happens after you have assigned a folder to static files as folder from your php file is located. I still do not have a workaround
I know it's late, but people still can use this help, php files can't be in static folders otherwise the browser will try to download them, to solve this i created a folder inside my views folder named static to hold my static files, then i used this line: app.use('/static', express.static(__dirname, 'views', 'static'); after this, all static files that are in views/static can be requested from host:port/static/
use res.render()
instead of res.sendFile()
basically i copy pasted you example and changed the directories, but when i request the page i get a download
php is the path