Getting this message on preview:
"Referencing to the file used in the field is not allowed."
followed by:

values = Array
(
    [created] => 
    [node_import_build_mode] => 1
    [title] => Southern Cross
    [cck:field_image_cache:fid] => Array
        (
            [0] => 6
        )

    [cck:field_image_cache:list] => Array
        (
            [0] => 1
        )

    [cck:field_image_cache:data] => Array
        (
        )

    [format] => 1
    [body] => Gunn-worn 10oz, -two large bellow chest pockets. -Cowhide collar. -Epaulets. -Full fitting.
    [type] => shirt
    [model] => 4S07
    [list_price] => 222.99
    [cost] => 333.99
    [sell_price] => 111.99
    [shippable] => 1
    [weight] => 500
    [weight_units] => g
    [length_units] => in
    [length] => 
    [width] => 
    [height] => 
    [pkg_qty] => 
    [default_qty] => 1
    [ordering] => 0
    [active] => 1
    [stock] => 1
    [threshold] => 1
    [revision] => 0
    [log] => Imported with node_import.
    [uid] => 1
    [promote] => 0
    [sticky] => 0
    [status] => 1
    [path] => 
    [comment] => 0
    [name] => admin
    [taxonomy] => Array
        (
            [2] => Array
                (
                    [0] => 3
                )

        )

    [field_image_cache] => Array
        (
            [0] => Array
                (
                    [fid] => 6
                    [list] => 1
                    [data] => 
                )

        )

    [op] => Preview
)

for a CCK filefield (imagefield) when importing an image to Ubercart. the following 2 products had no errors and their image came up fine.

CommentFileSizeAuthor
#1 kak-goods-test-set-stock-reject.csv_.txt701 bytescpill

Comments

cpill’s picture

StatusFileSize
new701 bytes

heres the error report CSV

cpill’s picture

looks like the image has already been imported on a previous import and its now pointing to the same file which is causing the error. The worse thing is that its stopping the import of the whole row :(

Should this be an error? Can't see where it originates from. The CCK filefield perhaps?

andor.koza’s picture

I have the same problem too...

did you solve this somehow?

jadwigo’s picture

This certainly has something to do with the CCK filefield because I have the same error for a file upload that's imported, but it looks not related to the actuial re-referencing of files...
(In an import I am trying there are a lot less duplicate files than the errors suggest.)

The actual error is actually on line 421 of filefield/filefield_widget.inc of filefield.module

form_error($element, t('Referencing to the file used in the %field field is not allowed.', array('%field' => $element['#title'])));

where you can see that the title is empty - which is probably wrong.

johhan’s picture

I think is not duplicate: as I can edit nodes with Image field, but this error is shown only when importing.

"Referencing to the file used in the field is not allowed." is shown in step "Preview import (step 7 of 8)"

If I try to import regardless, I get the error bellow, when import starts:
(I have rc4 now, with patch, but problems from the time, I tried DEV version and return back to rc4 - I deleted content of both node_import tables too)

user warning: Unknown column 'offset' in 'field list' query: INSERT INTO node_import_tasks (name, uid, created, changed, fid, has_headers, file_options, headers, type, map, defaults, options, offset, row_done, row_error, status) VALUES ('ex_boty_u_TEST3cZjednoduseno.txt', 1, 1259390125, 1259390125, 69, 1, 'a:11:{s:11:\"file_format\";s:3:\"csv\";s:16:\"record separator\";s:9:\"\";s:22:\"other record separator\";s:0:\"\";s:15:\"field separator\";s:1:\",\";s:21:\"other field separator\";s:0:\"\";s:14:\"text delimiter\";s:1:\"\"\";s:20:\"other text delimiter\";s:0:\"\";s:16:\"escape character\";s:1:\"\"\";s:22:\"other escape character\";s:0:\"\";s:5:\"title\";s:22:\"Comma Separated Values\";s:4:\"mime\";s:27:\"text/comma-separated-values\";}', 'a:14:{i:0;s:9:\"node_type\";i:1;s:3:\"pid\";i:2;s:6:\"export\";i:3;s:9:\"pCategory\";i:4;s:3:\"SKU\";i:5;s:5:\"nazev\";i:6;s:10:\"imagepath2\";i:7;s:7:\"catalog\";i:8;s:5:\"popis\";i:9;s:9:\"sellprice\";i:10;s:10:\"pListOrder\";i:11;s:8:\"sizesall\";i:12;s:5:\"jedna\";i:13;s:4:\"nula\";}', 'node:boty', 'a:26:{s:5:\"title\";s:1:\"5\";s:25:\"cck:field_image_cache:fid\";a:1:{i:6;s:1:\"6\";}s:10:\"taxonomy:1\";a:1:{i:7;s:1:\"7\";}s:4:\"body\";s:1:\"8\";s:6:\"format\";s:0:\"\";s:5:\"model\";s:1:\"4\";s:10:\"list_price\";s:0:\"\";s:4:\"cost\";s:0:\"\";s:10:\"sell_price\";s:1:\"9\";s:9:\"shippable\";s:0:\"\";s:6:\"weight\";s:0:\"\";s:12:\"weight_units\";s:0:\"\";s:12:\"length_units\";s:0:\"\";s:6:\"length\";s:0:\"\";s:5:\"width\";s:0:\"\";s:6:\"height\";s:0:\"\";s:7:\"pkg_qty\";s:2:\"12\";s:11:\"default_qty\";s:2:\"12\";s:8:\"ordering\";s:0:\"\";s:3:\"uid\";s:0:\"\";s:7:\"created\";s:0:\"\";s:6:\"sticky\";s:0:\"\";s:7:\"promote\";s:0:\"\";s:6:\"status\";s:2:\"12\";s:4:\"path\";s:0:\"\";s:7:\"comment\";s:0:\"\";}', 'a:14:{s:7:\"comment\";s:1:\"0\";s:6:\"format\";s:1:\"1\";s:3:\"uid\";s:3:\"jas\";s:7:\"created\";s:0:\"\";s:3:\"log\";s:26:\"Imported with node_import.\";s:6:\"status\";s:1:\"0\";s:7:\"promote\";s:1:\"0\";s:6:\"sticky\";s:1:\"0\";s:10:\"taxonomy:1\";a:1:{i:23;s:2:\"23\";}s:26:\"cck:field_image_cache:list\";i:1;s:4:\"type\";s:4:\"boty\";s:12:\"weight_units\";s:2:\"kg\";s:12:\"length_units\";s:2:\"cm\";s:11:\"default_qty\";i:1;}', 'a:2:{s:25:\"cck:field_image_cache:fid\";a:2:{s:18:\"multiple_separator\";s:0:\"\";s:14:\"manually_moved\";b:1;}s:10:\"taxonomy:1\";a:2:{s:18:\"multiple_separator\";s:0:\"\";s:19:\"hierarchy_separator\";s:0:\"\";}}', 0, 0, 0, 0) in /srv/web/virtuals/bike-sport.cz/www/includes/common.inc on line 3468.

johhan’s picture

So it is not sufficient to only remove content of 'node_import_tasks' and 'node_import_status' tables with "going back" to rc4, as there is field "offset" used in rc4, but "file_offset" in actual DEV version.

With "upgrading" rc4 -> DEV, the change is made by update script in this table (logically).

But when needed to "downgrade" from DEV to rc4, you need not only clear the content of Import node tables, but to remove both tables completly (or I tried to change their structure for now: I have only added 'offset' fields to these tables, so have both, 'offset' and 'file_offsed' fields present for testing needs)

Notice:
I need 'any' way of import products WITH some TAXONOMY/CATALOG information, and no result with it for now ...

seancorrales’s picture

I was searching for a solution to this issue and found this thead; I figured out a solution and wanted to share it here to help others who may have the same problem.

So here's what happens - when you upload all your files to Drupal's file system through an FTP program (usually 'sites/default/files'), Drupal isn't aware of them. When node import runs, it puts entries for the files into your "files" table in the database. When you try to re-run the same import, or use the same file at the same location, an error is encountered because there's already an entry for the given file in the "files" table.

Here's how I got around the problem. It requires modifying a database table so only try this if you feel comfortable doing so. Making a backup before starting is a good idea, too. Looking at cpill's original post, you'll see in the object that's printed out that there is an item called 'field_image_cache' and under it, an array. The key 'fid' is what you're looking for. In this case, it's 6.

Just go to the 'files' table in your database and find the matching fid(s) that are throwing errors and remove them. In this case, you'd just seek out the table row in 'files' with the fid of 6. Be very careful doing this - if other nodes are using the same file, this could cause some trouble. If you're like me and ran a small test before doing a massive data import, you can probably delete the entries without too much concern.

liquid06’s picture

I've had a similar problem - my process was to do a small test import, use views bulk operations to delete the test nodes, then do the big import. After deleting the test nodes and doing the big import, I encountered the 'referencing is not allowed' error. The first time it happened, I solved it in the way that droidenator suggests above, but on future tests I realized that deleting the test nodes was not deleting the test files. Looking more closely at the permissions on those files, I saw that Drupal did not have write access as it normally would if the files were uploaded through the node/add form.

On the next test, after copying the files needed for the import into their destination I modified their permissions to match those of other files in Drupal's files directory. Then when I deleted the test nodes, the test files were also deleted and therefore removed from the files table. This requires the extra step of re-copying the files before doing the big import, but in a situation where frequent tests and frequent imports are needed it seems a little less cumbersome than manually manipulating the table after each test import (especially if you happen to be inexperienced or uncomfortable with modifying database tables.)

shaneonabike’s picture

+1 Strange I found this in rc4 where the table somehow had changed to file_offset and had to rename it back to offset to get everything working properly

robcarr’s picture

I tried renaming the column names for tables node_import_status and node_import_tasks (file_offset -> offset) - it removed the error, so that the import started, but the import went kinda mad (some sort of infinite loop...); so then disabled and uninstalled the module (to delete the MySQL tables), downloaded the latest DEV version, re-enabled and all was normal: correct column names and node import worked fine.

farclouds’s picture

Works for me! 50% of computer problems can be solved with clean installations. :)

cainrus’s picture

SQL >> "DELETE FROM files". These will clean all info about old uploaded files.
And these helped me. but it can be dangerous for working site(you will delete information about all uploaded files;

EgorfromMurmansk’s picture

I have 50 add files. But ONLY 9 files is added. Others are not added.

cainrus’s picture

any logs in watchcdog section about these files?

gjones’s picture

I was able to bypass this check and successfully load in all of my images that were using the same file name by following the instructions here:

http://drupal.org/node/441280#comment-4605288 on fielfield_widget.inc

BigMike’s picture

@ #8 seancorrales: Thank you Sir for this solution!!

Kind Regards,
BigMike