I just turned on this module and set my tokens as [node:nid] for all my image and file fields.

I tried to upload an image, and I got the following error.
When I look via FTP, the image is uploaded properly, however when I check the "field_data_field_inline_images" table in the database there's no entry.

I then disabled the module, uninstalled it to remove the database entries, renabled it, and changed the name of the image that I was uploading in case I had missed a table in the database. It now appears to work correctly. I really have no idea what caused it but thought I should report it.

Error message:
----------------------
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://5/edit-fan-page-300x106.jpg' for key 2: UPDATE {file_managed} SET uid=:db_update_placeholder_0, filename=:db_update_placeholder_1, uri=:db_update_placeholder_2, filemime=:db_update_placeholder_3, filesize=:db_update_placeholder_4, status=:db_update_placeholder_5, timestamp=:db_update_placeholder_6, origname=:db_update_placeholder_7 WHERE (fid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => 1 [:db_update_placeholder_1] => edit-fan-page-300x106.jpg [:db_update_placeholder_2] => public://5/edit-fan-page-300x106.jpg [:db_update_placeholder_3] => image/jpeg [:db_update_placeholder_4] => 12440 [:db_update_placeholder_5] => 1 [:db_update_placeholder_6] => 1308684265 [:db_update_placeholder_7] => edit-fan-page-300x106.jpg [:db_condition_placeholder_0] => 9 ) in drupal_write_record() (line 6851 of /includes/common.inc).

Comments

jeffwidman’s picture

I experienced the error with another image that I had previously uploaded and then deleted from ftp and from the db. It threw the same error, so I renamed the image and now I don't have those problems.

So it appears I wasn't fully removing the images from the DB... which tables should I have removed it from?

h0tw1r3’s picture

Priority: Normal » Minor

First, removing/disabling ffp will not remove or update records/schema which would have an effect on the integrity violation. Currently, using this module means you are completely responsible for the naming of managed files/images. Normally, core would insure that filenames are always unique, but since you are defining the tokens it is up to you to generate unique names.

Feel free to submit a patch, otherwise I don't think this will be addressed any time soon (no active 7.x maintainer).

I would recommend either using different tokens to guarantee a unique name, or delete all your existing manage files and start over.

h0tw1r3’s picture

Status: Active » Closed (cannot reproduce)
mengi’s picture

Status: Closed (cannot reproduce) » Active

Having the same issue. I am trying to use ffp with a term (review type).

Error I receive:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://images/reviews/test/product-x/product-x-01.' for key 'uri': UPDATE {file_managed} SET uid=:db_update_placeholder_0, filename=:db_update_placeholder_1, uri=:db_update_placeholder_2, filemime=:db_update_placeholder_3, filesize=:db_update_placeholder_4, status=:db_update_placeholder_5, timestamp=:db_update_placeholder_6, origname=:db_update_placeholder_7 WHERE (fid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => 2 [:db_update_placeholder_1] => product-x-01.jpg [:db_update_placeholder_2] => public://images/reviews/test/product-x/product-x-01.jpg [:db_update_placeholder_3] => image/jpeg [:db_update_placeholder_4] => 203437 [:db_update_placeholder_5] => 1 [:db_update_placeholder_6] => 1358223535 [:db_update_placeholder_7] => product-x-01.jpg [:db_condition_placeholder_0] => 214 ) in drupal_write_record() (line 7106 of /example.dev/includes/common.inc).

mengi’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev

I am using the dev version of module.

Deciphered’s picture

Status: Active » Fixed

This sort of error is usually related to deleting the file via FTP after uploading via Drupal, then re-uploading. In which case, this error should happen regardless of having F(F)P on your site.

However, I'm more than happy to be corrected, if this is not what you are doing then please provides steps on how to reproduce this issue and I will investigate further.

Status: Fixed » Closed (fixed)

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