Welcome Guest, Not a member yet? Register   Sign In
codigniter and image download problem
#6

[eluser]Unknown[/eluser]
I've found that if you call the force_download function from a controller rather than a view it seems to work fine. When handing off to the view, there must be a function that pre-pends a couple of characters making your images corrupt. I'm using the other force_download helper that has been floating around and this code seems to work fine in jpgs.

Code:
$url = base64_url_decode($url);
    $path = dirname(FCPATH) . '/' . $url;
    $filename = explode("/",$url);
    $filename = end($filename);
    if(file_exists($path))
    {
        force_download($path);
    }
    else
    {
        show_404('this page');
    }

Hope that helps!


Messages In This Thread
codigniter and image download problem - by El Forum - 10-31-2008, 07:08 AM
codigniter and image download problem - by El Forum - 10-31-2008, 10:52 AM
codigniter and image download problem - by El Forum - 11-15-2008, 07:39 PM
codigniter and image download problem - by El Forum - 11-16-2008, 03:42 PM
codigniter and image download problem - by El Forum - 11-16-2008, 05:42 PM
codigniter and image download problem - by El Forum - 01-15-2009, 04:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB