views:

70

answers:

2

hello. i have this very simple download page to get an xml file. the script works ok in firefox/IE. but chrome renames the extension of the file to ".download". and this happens only to .xml, when you use another extension like .txt it does it without problems.

the body of the html is this:

<body>
  <a href="down.php">descarga</a>
</body>

and the php is this:

header('Content-type: "text/xml"; charset="utf8"');
header('Content-disposition: attachment; filename="example.xml"');
echo "that's it";

its very strange. any solution for this??

A: 

try removing 'echo "that's it";' it makes the xml invalid and might confuse the browser. if it doesn't help, check the actual http headers of both request and response.

kgb
A: 

This is not a definite answer, just some information for you.

From the bug report:

The downloaded file may get a different name if it is considered potentially dangerous for your computer (e.g. exe). You should then get an UI prompt in the download shelf asking you to confirm the download (with the file still downloading in the background).

Matt
right. the file is downloaded, the only problem is the extension rename. i wasn´t expecting a xml file to be considered potentially dangerous.
Alexander
Well, for now the only option i have is to place a warning for the user saying to check the extension in case he/she is using Chrome...
Alexander