Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When I upload a image in a node, delete it from the node and then upload it again it says:
An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /file/ajax/field_picture_flyer_1/en/0/form-XtmzIw64Wbu7-p7LGbi1BpsMQp8UCx15nZsJcdsuqIg
StatusText: n/a
ResponseText:
Error
Error message
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://flyer_picture_2.jpg' for key 2: INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) 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); Array
(
[:db_insert_placeholder_0] => 1
[:db_insert_placeholder_1] => flyer_picture.jpg
[:db_insert_placeholder_2] => public://flyer_picture_2.jpg
[:db_insert_placeholder_3] => image/jpeg
[:db_insert_placeholder_4] => 15277
[:db_insert_placeholder_5] => 0
[:db_insert_placeholder_6] => 1298292968
)
in drupal_write_record() (line 6776 of /home/latravia/sites/prive_frits/dev/estheticdentalteam.nl/includes/common.inc).
The website encountered an unexpected error. Please try again later.
ReadyState: undefined
The file is uploaded and renamed, but not in the DB.
Comments
Comment #1
Frits1980 CreditAttribution: Frits1980 commentedOk after some more testing I thought I had the solution, but the result is even worse (Critical).
I first thought I could easily get around this by removing the old picture and saving the node then editing it again and uploading that same picture. To bad that didn't work. Issue here is that it doesn't rename if there is already a file there with the same name, it just give an Ajax error simulair as mentioned in my first post.
Next thing I tried was renaming the file before uploading it again, ofcource this did work!
But after some more uploading and looking at my website I discovered that some images are copied over by others I have been uploading. So the whole renaming process just doesn't work flawless.
And since I have about 4000 pictures to upload in multiple content types this is a critical bug!
Please give some reaction. I'm really on a deadline. I know that I can't demand anything, but it would be nice just to know that someone is looking into it.
Thank you.
Comment #2
catchMoving this to the right component.
Can you confirm the file names are exactly the same - i.e. no difference in upper/lower case etc.
If there's a difference in case, could you post the MySQL collation being used?
Comment #3
bfroehle CreditAttribution: bfroehle commented@catch: I suspect your case sensitivity hunch is correct. #966210: DB Case Sensitivity: system_update_7061() fails on inserting files with same name but different case...
Comment #4
Alan D. CreditAttribution: Alan D. commentedInteresting. I found a similar thing in hook_date_formats() that has an unique format index in the database. Thus this:
threw a PDO exception.
EDIT
MySQL is case insensitive depending on the column collation. #1012620: Unique key on date_formats.(format|type) is problematic for case insensitive collations
Comment #5
dixon_I can't reproduce this bug. Can you clarify the steps involved in more details, on how to reproduce this?
The steps I went through to test this:
Nothing wrong happens, no error messages appears. I might have misunderstood this issue, so please correct me if I'm wrong.
Comment #6
aspilicious CreditAttribution: aspilicious commenteddixon did you use spaces in your name? Did you try the same name with different cases?
Insert "This is an image.png"
Remove "This is an image.png"
Insert "this is an image.png"
should work on paper.
Comment #7
catchI'm going to move this to needs more info until it's confirmed.
Comment #8
Frits1980 CreditAttribution: Frits1980 commentedOk, I've done some testing on an empty site with only drupal 7 core. No problems occur.
Apparently something went wrong with my other installation of drupal. And since nobody can reproduce that I'm going to assume we will never find where it went wrong. Since the other installation has about 12 contrib modules installed and another 14 or so installed and removed I think this would be a endless story to figure out.
Thank you guys for trying to help out!
Comment #9
narendra0111 CreditAttribution: narendra0111 commentedHi,
This is clearly a bug i'm facing it now. Suppose i have processe 200 created nodes with same image name and images renamed corretly till "image_name_200". But when i procees it again the on few files renaming error occurs like "file_name_153" already exists in the "file_managed" file.
Please provide a proper solution for this one.