There is the problem with import:

Error 1 when imported file "export1.export":
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp, uuid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1314703605 [:db_insert_placeholder_3] => b8e72ead-9837-cfa4-19d0-bcf99caf2727 ) in drupal_write_record() (line 6866 of /home/srv/www/s5.ovia.ru/www/includes/common.inc).

Error 2 when imported file "export2.export":
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'id' cannot be null: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 4610 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 663 of /home/srv/www/s5.ovia.ru/www/includes/file.inc).

The sites and structure is identical. Second site is the full copy of the first. Drupal 7.7, Node export 7.x-3.x-dev

CommentFileSizeAuthor
export2.export.txt19.65 KBrevardy
export1.export.txt27.07 KBrevardy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

danielb’s picture

Can you explain what 'node import with images' means?
e.g. field api image field with base64 export ?

danielb’s picture

oh I can work that out from your exports, nevermind

Basically the problem is I ported that code to 7, but it was written by James Andres, and I have difficulty understanding the Drupal 7 file handling changes. So any input/suggestions would be fantastic...

danielb’s picture

Assigned: revardy » James Andres
James Andres’s picture

I have had trouble with the same issue actually. I'm considering massively simplifying the node_export_file module now that D7 has the field API. This should help reduce current and future bugs.

Can I get a quick poll from you two (or anyone else interested)?

These are features I reckon should be on the chopping block:

  1. "Local file export" mode aka "Local path" mode
  2. "Remote file export, URL" mode

Anyone using these features (why, when inline mode seems to work so well!?)? Any objections?

sirish.ayyagari’s picture

i am also getting the same error . below is the error

* Unknown error occurred attempting to import file: public://pdf/epa-nanotechnology-whitepaper-0207_1.pdf

* Unknown error occurred attempting to import file: public://images/bar-chart-vertical_1.gif

* PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp, uuid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1316537676 [:db_insert_placeholder_3] => 89a009b3-a0f3-3284-2984-846c93f63b41 ) in drupal_write_record() (line 6868 of /opt/lampstack-3-0-6-0/apps/drupal/htdocs/includes/common.inc).

danielb’s picture

If the node_export_file module can be simplified enough that it only integrates with drupal 7+ core file functionality (e.g. fields), perhaps we could roll this functionality into an .inc file, and rather than hooking into node export, node export would actually call the node_export_file* functions as needed?
Had a few issues on here with people not realizing they had to turn an extra module on to make this stuff work.

danielb’s picture

FYI a very similar error used to appear for D7 export file uploads.
#1192586: file upload error if temp file exists
I managed to fix it, but I don't fully understand it, and I don't think the solution would be appropriate in this case.

crimsondryad’s picture

Does anyone have a workaround for this? We're getting ready to migrate a bunch of content from one site to another and if this worked it would really help.

carl.brown’s picture

Does anyone have a workaround for this? We're getting ready to migrate a bunch of content from one site to another and if this worked it would really help.

If you export a node that includes a file and you use the inline mode:

Inside export code (base 64 encoded string)

it works like a charm. I've tried it with both images and PDFs and it went better than I could have imagined. I guess it all depends how many nodes you're trying to export vs. how big the attached files are, but certainly in my experience there haven't been any problems.

danielb’s picture

Status: Active » Fixed

I've removed the modes james andres mentioned in post #4, I think leaving it too long just causes more people to run into this issue, so I thought I'd get it done.
This change is for Drupal 7 only.
It has removed a fair chunk of code but not enough at this stage to roll node_export_file into node_export, perhaps in a future redesign.

Status: Fixed » Closed (fixed)

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

selvakumar’s picture

Fixed:
In Drupal 7, we have to use file_create_url() instead of url() in node_export.module line no 1052.

RAWDESK’s picture

Issue summary: View changes

If your files are on public:// , the best option at /admin/config/content/node_export is "Remote file export, URL".
Certainly if you have a lot of nodes and/or large files to migrate.

dsteplight’s picture

Also make sure via /admin/config/content/node_export that you have the right content types checked under "File fields" for the content types you are using during your imports for the images that are giving you problems.