Question

For some reason I can't get the image to display properly, its chucking out errors not telling me what’s wrong, any ideas?

CODE

$finfo = finfo_open(FILEINFO_MIME_TYPE);
header("Content-type:   ".finfo_file($finfo, $filepath));
finfo_close($finfo);
header('Content-length: '.filesize($filepath));
header('Content-Disposition: inline; filename="'.$file.'"');
header('X-Sendfile: ' . $filepath );

HEADERS

HTTP/1.1 200 OK
Date: Mon, 07 Apr 2014 13:45:37 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3.10
X-Sendfile: /path/image.jpg
Content-Length: 0
Content-Disposition: inline; filename="image.jpg"
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: image/jpeg
Was it helpful?

Solution 2

The above code did work, it was x-sendfile which was not configured properly in apache

OTHER TIPS

Are you sure your file is there?

I see Content-Length: 0. I doubt you want to send empty file.

Try to remove headers output and replace it with echos to see where your scrit fails.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top