When downloading dmFiles, if the filename contains a period (.) in the name
(additional to the one denoting the file extension), the file might not be
displayed correctly by the web browser.

The reason is the code to determine the file extension and subsequently the
content-type doesn't handle the extra periods in the filename

I assume most mime types will be handled correctly, but for PDFs, the
content-type of application/unknown causes it not to render in the browser
(it can be "saved as" and then loaded correctly).

The simplest fix for me obviously is to rename the pdf, but here are a
couple of other suggestions:

1. Don't send the content-type header if the file extension isn't know
(instead of sending application/unknown). Let the browser figure it out for
itself

2. Change the code to determine the file suffix. Currently looks like:

  <cfset pos = find(".", stFile.filename)>
  <cfset suffix = removeChars(stFile.filename, 1, pos)>

   The following code will search for the extension from the end of the file
instead of the start:

  <cfset matches = REFind("[^\.]+$", stFile.filename, 1, true) />
  <cfset suffix = lcase(mid(stFile.filename, matches.pos[1],
matches.len[1])) />


Cheers

--

Quentin Zervaas
Web Developer

MITOUSA.
Web + Interface Architects

E:// [EMAIL PROTECTED]
W:// www.mitousa.com



---
You are currently subscribed to farcry-dev as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to