When I add documents with filefield and click upload, it shows the correct icon (pdf, text, etc.) next to the field for the name of the document, but when I click submit to submit the content. The page shows a blank page icon. Looking at the code I get very strange class names and image class names for the icons. For example:

<div class="filefield-icon field-icon-cannot open `files-forms-Direct Deposit Form- Non-US Bank.pdf&#039; (No such file or directory)"><img class="field-icon-cannot open `files-forms-Direct Deposit Form- Non-US Bank.pdf&#039; (No such file or directory)" src="http://www.mysite.com/sites/all/modules/filefield/icons/protocons/16x16/mimetypes/application-octet-stream.png" /></div>

I downgraded to version 5.x-2.3rc4 and found this issue does not exist. Has anyone else encountered this?

CommentFileSizeAuthor
#2 mimedetect-288811-realpath.patch693 bytesdboulet

Comments

dopry’s picture

Status: Active » Closed (fixed)

1) install the transliteration module if you haven't. 2 verify mimedetect is working properly... test with head.. There was a minor changes to the icon generating, but this looks like mime detect cannot open the file.

dboulet’s picture

Project: FileField » MimeDetect
Version: 5.x-2.3 » 5.x-1.0
Category: support » bug
Status: Closed (fixed) » Needs review
StatusFileSize
new693 bytes

I was having the same problem as the original poster. The problem is that, when using the PHP fileinfo extension, the function finfo_file() can't find the file when passed $file->filepath as an argument. This could be a result of running Drupal in a Windows environment.

The attached patch passes $file->filepath through the realpath() function so that the file is properly located by finfo_file().

jcmarco’s picture

Title: Icons are incorrect » info_file() error: Failed identify data -1:cannot open '' (No such file or directory)
Version: 5.x-1.0 » 5.x-1.x-dev
Status: Needs review » Reviewed & tested by the community

Great!
I had the same error reported in #2, about the finfo_file() function.

info_file() [function.finfo-file]: Failed identify data -1:cannot open `' (No such file or directory) in /xxxx/sites/all/modules/mimedetect/mimedetect.module on line 181.

Once applied the patch, the error flew.

A different one is that the module some times failes detecting the format, when the unix file works fine.
Would be nice have in the configuration menu an option to force the use of the unix file detection.

I am running Linux servers so is not related with the platform.

drewish’s picture

Title: info_file() error: Failed identify data -1:cannot open '' (No such file or directory) » finfo_file() needs the canonical path to the file.
Version: 5.x-1.x-dev » 6.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

thanks, committed to HEAD and DRUPAL-5

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.