CodeIgniter Forums
Error downloading files (Resource interpreted as Document but transferred with MIME type "image/jpeg".) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Error downloading files (Resource interpreted as Document but transferred with MIME type "image/jpeg".) (/showthread.php?tid=45629)



Error downloading files (Resource interpreted as Document but transferred with MIME type "image/jpeg".) - El Forum - 09-28-2011

[eluser]coffak[/eluser]
Hi to all,

I'm doing an application that needs to download files from the server, and I'm using the download helper. Here is the function I call to download the files:

Code:
public function downloadFiles($file_name)
    {
        $this->load->helper('download');
        $data = file_get_contents(base_url()."uploads/".$file_name.".jpg");
        force_download($nombre_archivo."_anexo.jpg", $data);

    }


The problem is that the file is downloaded but I can't open it, Picassa (or any other image editor) gives me the error "Invalid Image". Also google chrome gives me this warning when the file is downloaded: Resource interpreted as Document but transferred with MIME type "image/jpeg".

I have searched in google , and it seems that has something to do with the headers, but I don't have a clue.. So, thanks in advance for any help

Regards