• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error downloading files (Resource interpreted as Document but transferred with MIME type "image/jpeg".)

#1
[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




Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.