I have media 2.x and if i upload an image with the media browser i get the message
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '37-width' for key 'PRIMARY': INSERT INTO {file_metadata} (fid, name, value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2), (:db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 37 [:db_insert_placeholder_1] => width [:db_insert_placeholder_2] => i:1280; [:db_insert_placeholder_3] => 37 [:db_insert_placeholder_4] => height [:db_insert_placeholder_5] => i:800; ) in file_entity_file_insert() (line 70 of /httpdocs/sites/all/modules/file_entity/file_entity.file.inc).
Comments
Comment #2
yuseferi CreditAttribution: yuseferi commentedI have the same problem, I have a custom hook_file_insert in my module
everything worked correctly but when I install file_entity module when try to upload file I face this problem
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3343-width' for key 'PRIMARY': INSERT INTO {file_metadata}
where is the problem and how I resolve it?
Comment #3
Dave Reid@zhilevan: The problem is calling file_move(), which saves managed files, from a hook where a managed file is being saved (and creates unnecessary loops). You should switch to using file_unmanaged_move() which would avoid it.
Comment #4
fox_01 CreditAttribution: fox_01 commentedI think this issue is a problem. i run into that issue after (i assume that this is reason) uploading has aborted because of redirection issues but now that issues are solved and i get this error everytime uploading a file
Found a possible source error #1349288: devel generate has to create paths for filefields
Comment #5
saleempbt5 CreditAttribution: saleempbt5 commentedI have same problem, has anyone got solution for this?
Comment #6
joseph.olstadplease provide version and debug information, error messages, what happens before and after error, how to reproduce. What version of database ? mysql, postgresql , mssql ?
version number?
what version of file_entity , what version of core, what version of the 'media' module (if you are using it).
apache error log for the precise moment of the error OR watchdog/dblog (drupal log).
Comment #7
saleempbt5 CreditAttribution: saleempbt5 commentedI am sorry i forgot to give more details about the error.
Core version : 7.59
Database system MySQL 5.7
fileentity version : Version: 7.x-2.0-beta1
Media : Version: 7.x-2.0-alpha4+38-dev
This is my code
and this is what i am getting in the dblog after getting an ajax error
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '257473-width' for key 'PRIMARY': INSERT INTO {file_metadata} (fid, name, value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2), (:db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 257473 [:db_insert_placeholder_1] => width [:db_insert_placeholder_2] => i:889; [:db_insert_placeholder_3] => 257473 [:db_insert_placeholder_4] => height [:db_insert_placeholder_5] => i:278; ) in file_entity_file_insert() (line 70 of /var/www/html/sites/all/modules/file_entity/file_entity.file.inc).
Comment #8
joseph.olstadThose are pre-releases of media and file_entity.
Have you tried upgrading media and file_entity?
Try to disable your custom code temporarily, then upgrade to media 7.x-2.23
also upgrade file_entity to 7.x-2.25 at the same time, replace the older versions with the new.
then make sure to visit update.php or do a drush updb
clear caches, check to see if your system is working as expected
then you'll probably want to follow the media recipe for optional configuration and troubleshooting tips
once you've done that, try your custom code again.