I'm using FileField to upload some Flash (swf) content using the private file system with the files stored outside the document root. Trying to directly view the swf file in system/files/ results in the browser wanting to download it. I checked the Content-Disposition setting in FileField and it appeared to be correct.

Looking at the headers which were being sent by file_download in Drupal's includes/file.inc I noticed there were 2 sets:

Content-Type: application/x-shockwave-flash; name="headerX.swf"
Content-Length: 82882
Content-Disposition: inline; filename="headerX.swf"
Cache-Control: private
Content-type: application/x-shockwave-flash
Content-Length: 82882
Content-Type: application/x-shockwave-flash
Content-Length: 82882
Cache-Control: public
Content-Disposition: attachment; filename="headerX.swf"

Commenting out the header array returned by filefield_file_download() in filefield.module results in the following:

Content-type: application/x-shockwave-flash
Content-Length: 82882
Content-Type: application/x-shockwave-flash
Content-Length: 82882
Cache-Control: public
Content-Disposition: attachment; filename="headerX.swf"

Somewhere along the line an extra set of headers is being generated which is overruling the previous ones. If I manually change "attachment" to "inline" inside includes/file.inc then I can view the swf file as expected.

I'm having trouble pinpointing the cause of the problem, Filefield may not be at fault here.

Using PHP 5.3, haven't tried it with any other versions.

Comments

imclean’s picture

Project: FileField » File Aliases
Version: 6.x-3.7 » 6.x-1.1

Moved from FileField.

Disabling File Aliases module removed the extra headers. Competing hook_file_download headers perhaps?

Although File Aliases should be using the same headers.

Current headers:

Content-Type: application/x-shockwave-flash; name="headerX.swf"
Content-Length: 82882
Content-Disposition: inline; filename="headerX.swf"
Cache-Control: private
Content-type: application/x-shockwave-flash
Content-Length: 82882
Content-Type: application/x-shockwave-flash
Content-Length: 82882

3 x "Content-Type", one malformed. Only one with the file name (FileField's header I believe). 3 x Content-Length. Surely there's got to be a better way to managed multiple download modules.

Deciphered’s picture

Status: Active » Closed (won't fix)

The Drupal 6 version of this module will not be receiving any more support.