no files were imported
jsgammato - August 11, 2008 - 21:47
| Project: | File import |
| Version: | 5.x-1.0 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I just installed File import. It finds the files in my /import folder just fine, but it does not import them. I get this message:
warning: Invalid argument supplied for foreach() in /webroot/s/g/sgamm001/www/stc-ctf/includes/form.inc on line 949.
Also, no nodes are listed in the dropdown.
Is there something that I did wrong?

#1
ps The screen is too wide for the page, too. There's obviously something screwy in the interface, but I can find no documentation to help me work through this issue.
#2
I just installed this module and used it successfully. In fact, it works like a charm. If you're experiencing problems, try checking the names of your files. One or more of them might contain some funky character that's throwing the above error.
#3
I experienced this too, until I opened the 'page' content type and saved it. I expect you have an empty "ID - Title" dropdown as well? (EDIT: Oh, I guess you said that you do in the original post...)
I believe this may be due to file_import not anticipating the default "allow file attachments" settings. If the content type's settings page has never been saved, the 'file attachments' setting will not actually exist - the file upload module using an internal default of 'true' for the 'page' content type - so file_import can't find any content types with file attachments enabled.
An easier alternative to rummaging around with the defaults would be to provide a more useful error message than 'no files were imported'. Certainly it should be noted whether a file attachment has been rejected due to the node type not supporting attachments, or due to a non-existent node ID, or some other reason.
#4
Also, the page being too wide is a natural result of using text fields and arbitrary filenames in rows of a table.
#5
Thanks, this answer helped me, too. Once I opened and resaved the Page content type, I was able to import. I think at minimum it would be a good idea to put a note about this on the configuration page for the File Import module.
#6
A popular alternative to documenting broken behaviour is ... fixing the problem :)
I noticed this bug also when porting this module to D6, so here's the patch against 5.x for that issue alone.
The per-contenttype 'upload_page' (and 'upload_blog', 'upload_story' etc) variable only gets saved when the content type is edited, so this module will not function on a default Drupal install with a single node added.
Otherwise, no nodes are made available to attach the files to.
I have not tested this code extensively, but can confirm that it worked for me.
It's intended to reverse the test for whether upload_page and friends are set. Previously, file_import did
<?phpif ((!$only_with_uploads)||(variable_get("upload_$type->type", $only_with_upload))) {
?>
but instead, this patch makes it do
<?phpif ((!$only_with_uploads)||!(variable_get("upload_$type->type", $only_with_upload)==0)) {
?>
#7
Patch to fix this issue attached.
(Reposting; my original patch comments didn't appear in the issue updates, and there seem to be a few people waiting on this fix.)
#8
Apologies - either my internet connection or D.O is flaking today, causing form submissions to appear unresponsive. I blame the internet this end. And the ducks.
#9
Fixed in 5x-1.1 and 6.x-beta1
#10
Automatically closed -- issue fixed for 2 weeks with no activity.