#2652 bug about show a excel file in IE

open
nobody
5
2009-07-09
2009-07-09
cowboy
No

the content type is incorrect.it is no need to add the name property.

http://squirrelmail.svn.sourceforge.net/viewvc/squirrelmail/trunk/squirrelmail/functions/mime.php?view=annotate
2764 : // Try to show in browser window
2765 : header ("Content-Disposition: inline; filename=\"$filename\"");
2766 : header ("Content-Type: $type0/$type1; name=\"$filename\"");

the output header
Content-Type:application/vnd.ms-excel;name=XXXXXXX
may cause IE show the excel file content directory as a text file.

thank you very much.

Discussion

  • cowboy

    cowboy - 2009-07-10

    Code1
    <?php
    header('Content-Type: application/vnd.ms-excel;name="%E6%96%B0%E8%A6%8FMicrosoft%20Excel%20%E3%83%AF%E3%83%BC%E3%82%AF%E3%82%B7%E3%83%BC%E3%83%88.xls"');
    echo "i'am in the excel file.";
    ?>

    Code2
    <?php
    header('Content-Type: application/vnd.ms-excel;name="1.xls"');
    echo "i'am in the excel file.";
    ?>

    Evn:IE7,XP,ja
    Code1 will show the content in IE.But Code2 will show download dialogue 。

     
  • Jonathan Angliss

    Maybe I'm a little confused, but your example shows the only difference being in the name="" bit, which is URL encoded in one, and simple in the other, but you're showing a really basic example, SquirrelMail excluded, and getting different behavior from your browser. Or, am I missing something else?

     
  • cowboy

    cowboy - 2009-07-31

    there is a BUG(?) with IE.(i test only on IE 7 japanese verion.)if there is a NAME property with Content-Type,it may process it incorrectly.
    in fact,it is not necessary to set the NAME property.

    let me show the test code:
    <?php
    $f="新規Microsoft Excel ワークシート.xls";
    header('Content-Type:application/vnd.ms-excel;name="'.rawurlencode(mb_convert_encoding($f, $_GET['sjis']=='y'?'SJIS':'UTF-8')).'"');
    echo "a raw data in excel format.should not be in IE as text plain";
    ?>
    when i browse the code,i take the two pics:
    http://img380.imageshack.us/img380/9708/20090731112919.png
    http://img60.imageshack.us/img60/5136/20090731112942.png

    so, please remove the NAME property.

     
  • Paul Lesniewski

    Paul Lesniewski - 2009-07-31

    I cannot reproduce, although I can't see an excel file in my browser no matter which browser and which way the code is set (probably because I scoff at using MS Office).

    I'm not so convinced about changing the name attribute for this one example because I think it is there for a reason - this code has been developed over 10 years of trial and error.

    That said, apparently there is a problem in this one case. And if the point is to show the file in the browser, is the name attribute necessary? It might be necessary for the rest of the world that does not have the browser extensions to see exel files in their browser, in which case the name attribute might be very helpful for naming the downloaded file.....

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks