0

I'm using Drupal 7.28. Today when I tried to upload some 100 image files in Image field type, it aborted in the middle saying that "20 MB" limit reached. Now it wouldn't even show me way to delete the files.

Since then I'm getting the following error (below). when I try to upload the same files.

I've run cron and also cleaned all caches but this error does not go.

I can see that these orphaned files are still stored in the file_managed table.

How can I resolve this problem?

Related post: https://stackoverflow.com/questions/8809010/pdoexception-on-duplicate-filename-in-drupal-7

Another solution comment here on Drupal.org which says that such files should be cleaned by 6 hours by Cron run.

Error on repeat uploads

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://wsgallery/DSC00441.jpg' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp, type) 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, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => DSC00441.jpg [:db_insert_placeholder_2] => public://wsgallery/DSC00441.jpg [:db_insert_placeholder_3] => image/jpeg [:db_insert_placeholder_4] => 305012 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1413799461 [:db_insert_placeholder_7] => image )

1 Answer 1

0

Check whether the file is being used by another part of the system with the file_usage_list()

$file = file_load($fid);
$usage = file_usage_list($file);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.