Reply to Re: Image MIME/file type

Your name:

Reply:


Posted by Vertuas on 11/07/06 17:59

Thanks again guys

I found this code on php website

$f = fopen("file.txt", "rb");
$content_len = (int) filesize($f, "file.txt");
$content_file = fread($f, $content_len);
fclose($f);

$output_file = 'MXimage.jpg';

@ob_end_clean();
@ini_set('zlib.output_compression', 'Off');
header('Pragma: public');

header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Content-Transfer-Encoding: none');
header('Content-Type: application/octetstream; name="' . $output_file .
'"'); //This should work for IE & Opera
header('Content-Type: application/octet-stream; name="' . $output_file .
'"'); //This should work for the rest
header('Content-Disposition: inline; filename="' . $output_file . '"');
header("Content-length: $content_len");

echo $content_file;
exit()

the filename MXimage.jpg is my own test image file.

when i point IE at it, i get a message about a 3 byte HTML file. Why does
that image file not come through? It seams that the script doesn't even pass
the image data on.

is this something to do with the way PHP handeles the headers. Its running
on a Linux host.

Thanks again

"Vertuas" <vertuas@hotmail.com> wrote in message
news:u%%3h.14794$163.13570@newsfe6-gui.ntli.net...
> Hi All,
>
> Is there a way to get PHP to change the mime type for a file sent to a
> browser.
>
> I need my website viewers to be able to click a link to directly download
> and save an image, rather than the browser displaying it.
>
> Is there some other way to make this happen?
>
> Thanks
>
> David
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация