erw-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Erw-devel] show.php


From: erw-devel
Subject: [Erw-devel] show.php
Date: Wed, 27 Jul 2005 01:46:32 -0400
User-agent: Mutt/1.5.9i

show.php

Doesn't correctly identify mime types because .extension (with dot) doesn't 
match
mime.php entries. Either genmime.php needs to change and add dots, or this 
worked
for me in ERW.php:


                $ext = strtolower(strrchr(basename($filename), "."));
becomes:
                $ext = strtolower(substr($filename, strrpos($filename, '.') + 
1));

Haven't tested deviant cases where there are multiple periods (possible?) or no 
extension at all.

---------

Second - when it DOES find a match, it's too late to change the header and add 
the right mime type.

This worked for me:

ERW::connect();
ERW::checkValidUser();

move this block to right after ^^

if (isset($id)) $file = "$_ERW_fileBasePath/".str_replace("_", "/", 
$type)."/".ERW::getOne("file from $type where id=$id");
else list($dummy, $file) = ERW::unpackArray($file);

Header("Content-Type: ".ERW::MIMEtype($file));


which DEFINITELY breaks the logic ... but it works.


---------

Final note - it appears that firefox ignores the Content-Type header, possibly 
because I have the
web developer plugin, but I don't think that's it.

I will be playing with this a bit more and report what I find..

Alfred




reply via email to

[Prev in Thread] Current Thread [Next in Thread]