I have been playing around with the download() command to be able to download files which i locked from public with htaccess but it seems like when the download process is starting and seeming to finish, the downloaded file seems to be corrupted.
I simply used this line of code, is there any other required things to get a working file??
Do you have some plugins installed? Try removing them all and see if this fixes it. I saw that some plugins create some unwanted output, which is not good. You should also not use the html minification plugin in combination since it will compress all output, even the file content and this leads to corrupted download files.