Welcome Guest, Not a member yet? Register   Sign In
File downloader doesnt seem to work

I have an internal application that allows the upload and download of zip files. The upload works as when I FTP into the folder and download it using filezilla it is fine, but when I use the following code:
function getfile($filename=null){
if($filename==null){redirect('welcome/download'); }
$string = read_file('./downloads/'.$filename);
force_download($filename, $filename);

When I save it on to the computer and try to open it, then I get an error message saying that the file is corrupt or invalid message.

Could it be something to do with headers or anything, or do I need to load a view etc? I have looked on the forums and came across something similar but the fix in the mimes,seemed to have no effect..

Does anyone know why this may be the case?

Also I think it has a problem getting images as well as Zips.


Sorry, After a bit of a break, I saw my error, I was putting the filename as the contents rather than the actual contents.. thousand apologies!

Theme © iAndrew 2016 - Forum software by © MyBB