EllisLab text mark
Advanced Search
     
Error downloading files (Resource interpreted as Document but transferred with MIME type “image/jpeg”.)
Posted: 28 September 2011 06:49 PM
Joined: 2011-03-25
10 posts

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:

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

 

 
Posted: 28 September 2011 07:23 PM   [ # 1 ]   [ Rating: 0 ]
Joined: 2011-04-19
89 posts

mabe try this one ?
http://ellislab.com/forums/viewthread/95529/#516980

 
Posted: 29 September 2011 10:42 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2011-03-25
10 posts

Hi jacobson,

I took a look on the thread, and it seems that my problem is the path to the file, because when I check if the file_exists() returns false. However I have checked twice the path and is correct (I am not sure if should I use relative or absolute path).

I guess that has something to do with the permission of the file, because according to the documentation of the file_exists function, it returns false when the file is not accessible…

Thanks, I’ll try to catch the bug, any idea is welcome