Download & Extend

Can't Import Filefields that are not images

Project:Imagefield Import
Version:6.x-1.9
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)

Issue Summary

As advertised, I'm trying to use this module to bulk upload filefields that aren't images. I've got a content type with a filefield that I'm targeting via the imagefield_import settings. Everything is good. But I'm getting:

"The import folder has been correctly configured, but it seems that none of the files in the folder can be read by the webserver. Please fix the permissions and try again."

Note that if I remove the docs from that directory and put jpgs in there. I have no trouble importing... out of the very same directory. So I'm not convinced this is a permissions issue.

Any idea?

Thanks for the great module!

Shai

Comments

#1

Hi, i was recently strugling with this very same issue too. I solved this be one not very pretty hack directly to module core, I dont really like it very much, but I didn't find another way around.

File imagefield_import.module:
Line 381
    if ($info && isset($info['extension'])) {
changed to
    if (1) {
so that the condition always return true (or you can remove the whole if with {} braces of course)

Line 652
  if (file_check_location($filepath, $directory) && $info = image_get_info($filepath)) {
changed to
  if (file_check_location($filepath, $directory)) {

Line 691
  if (file_check_location($filepath, $directory) && $info = image_get_info($filepath)) {
changed to
  if (file_check_location($filepath, $directory)) {

File imagefield.module (directly into Imagefield module folder):
Deleted line 233
  $validators['filefield_validate_is_image'] = array();

Now you can start listing all the reasons why this was a really wrong move to do so :) I mean seriously - please do so, I know that this was really wrong and could be pain when debugging something else later.

#2

This is a big problem for me too, though I'm using version 1.10. Subscribing!

#3

@svihel, this is really helpful!

I need this bulk import as part of a data migration, not permanent feature. And that might be true for others as well. So here is a recipe that gets the job done but tries to follow best practices:

1. Hack the modules according to @svihel's recipe
2. Do my bulk file imports
3. Delete the imagefield and imagefield_import modules
4. Download fresh versions of the imagefield and imagefield_import modules
5. Bookmark this page for future re-use.

I wouldn't recommend people using the hacks as a permanent solution.

Hopefully, at some point the module maintainers will get around to fixing the modules, given that it is an advertised future. But in the meantime, I think @svihel's explicit hack instructions are really helpful.

in my actual case, I've decided to hire my 12-year old son at $4 an hour to upload the files one at a time. There are always many solutions! :)

Shai

#4

I installed the hacks from #1 and used it. Works great! Thanks.

I don't think the changes will ever be made to the image and imagefield_import modules to make it so that this module will work with files. It would make the UI for importing images so confusing especially considering the name of the module, etc. I think it was an unsupported feature that died when the code got tightened up (for the good) in its evolution.

I think the reference on the project page that this module works for files other than images should be removed.

Then maybe a new module, "filefield_import" could be created, largely cloned from the imagefield_import module and then tweaked for files.

Shai

#5

Status:active» postponed (maintainer needs more info)

Shai-

I'm not overly familar with the filefield import side of the module.

You're right, it was actually added relatively recently by wulff.

He may have some perspective on that.

I'm not a big fan of it being a part of the module, since it's outside of my desired scope.

I'll probably chop it out of a D7 version.

Do the changes to the code posted in #1 cause other issues with the remainder of the functionality? (I honestly haven't looked at them very closely)?

#6

At some point it was possible to use this module to import files to filefields (since imgefield is based on filefield), but this is no longer possible, since the import code now uses imagefield upload validators.

I'm thinking we could improve the admin settings form to only show content types with imagefields instead of showing all filefields as is the case now.

#7

Not sure if I should create a new issue for this or not but I'm trying to do the same thing: upload multiple files, some of which are not images. In my case, however, I am not getting any message or anything. I have files I'm attempting to upload that are JPG, GIF, PNG, EMF and EPS. All of the files show up on the import page except the EMF and EPS formats, even though I've added those extensions to the allowable file types in the CCK field. I am not trying to display the EMF or EPS images in the node, obviously, I just want the file available to download. Am I doing something wrong? Any help would be much appreciated.

Thank you

nobody click here