I suppose this question has been asked somewhere, but I can't seem to find a solution.

In the websites I manage, PDF files uploaded via FileField are downloaded instead of displayed in the browser window. Of course I'm talking about the browsers—like Safari and IE—that support in-browser PDF display. The Upload module allows this, and it seems strange that FileField doesn't.

Any suggestions?

Thanks.

Comments

quicksketch’s picture

Are you using private or public downloads (set at admin/settings/file-system)? There's the opposite (force a file to download) instructions at http://drupal.org/node/417866 for public downloads. For private downloads you need to set a hidden variable "filefield_inline_types" by putting this in your settings.php:

$conf['filefield_inline_types'] = array('^text/', '^image/', 'flash$', 'application/pdf');
antiorario’s picture

Sorry for the delay, but for some reason I'm not receiving e-mail notifications of issue updates.

Thanks for the input. I'm using private downloads, and I'll definitely try that and see what happens.

quicksketch’s picture

Status: Active » Closed (fixed)
antiorario’s picture

I finally tried it, and it worked perfectly. Of course I realized that the same can be achieved, in the appropriate context (such as a module install function), with:

<?php
variable_set('filefield_inline_types', array('^text/', '^image/', 'flash$', 'application/pdf'));
?>

I'm mostly writing this as a note to myself—and to anyone who might be interested.