(using csv, but dont think that matters)
* on node/add/node_export upload "test.csv"
* (node import fails or some other appleft a file with that name in temp)
* on node/add/node_export upload "test.csv"
result:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'temporary://test.csv' for key 'uri': 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] => 2 [:db_insert_placeholder_1] => node_export1.csv [:db_insert_placeholder_2] => temporary://node_export1.csv [:db_insert_placeholder_3] => text/csv [:db_insert_placeholder_4] => 706 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1308398396 ) in drupal_write_record() (Zeile 6776 von /home/xl/workspace/lange/includes/common.inc).
Comment | File | Size | Author |
---|---|---|---|
#19 | Untitled.png | 15.49 KB | sj.suraj |
Comments
Comment #1
geek-merlinthis might in fact be a file_save_upload() bug, but could not find a matching right now.
Comment #2
geek-merlinfunny, i can reproduce this every *second* time i upload a file with same name.
!!! even without any import error, so in fact this (from description) is NOT necessary:
* (node import fails or some other appleft a file with that name in temp)
Comment #3
danielb CreditAttribution: danielb commentedI'm not exactly an expert in drupal 7 file handling, any ideas on what is wrong?
Comment #4
danielb CreditAttribution: danielb commentedComment #5
IanNorton CreditAttribution: IanNorton commentedI'm having exactly the same problem, the first time I upload an XML (in this case) file the import works perfectly, the second time it is already in the 'file_managed' table, so an error is thrown (see below) - clearing the offending entry from the 'file_managed' table fixes it, likewise, changing the file name also gets around the issue.
I would guess that the would be to clear the 'file_managed' table once the transaction's complete?
Comment #6
danielb CreditAttribution: danielb commentedHmm I wonder whether we can get at that file without using file_save() at all. Otherwise, just delete that one file right after we're done?
Comment #7
IanNorton CreditAttribution: IanNorton commentedI think the quick fix would be to delete it from file_managed at the end of the process, at this point it's been added as a node so I can't see the need for it to remain in file_managed - I may be wrong on that, but removing it didn't cause me any trouble.
Comment #8
danielb CreditAttribution: danielb commentedComment #9
danielb CreditAttribution: danielb commentedComment #10
danielb CreditAttribution: danielb commentedThe might be fixed now, please check the 7.x-3.x dev version releases after this date.
Comment #11
danielb CreditAttribution: danielb commentedmarking as fixed due to lack of further bitching
Comment #12
IanNorton CreditAttribution: IanNorton commentedSorry - still does exactly the same,
Whenever the file name is the same as a file previously uploaded the error occurs.
Comment #13
geek-merlinso still an issue
Comment #14
danielb CreditAttribution: danielb commentedI managed to reproduce this error, but I kept getting a lot of other warnings and noticed a few other little issues like the filename not being formatted correctly. I fixed those, and now I'm not getting the error anymore?
I'm repeatedly importing the same node over and over again. I've committed that.
Comment #15
danielb CreditAttribution: danielb commentedComment #17
Darkflash CreditAttribution: Darkflash commentedSame problem so i reopen the bug.
Drupal version : 7.23
Error message
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'temporary://export_campaign.zip' for key 'uri': 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] => export_campaign.zip [:db_insert_placeholder_2] => temporary://export_campaign.zip [:db_insert_placeholder_3] => application/zip [:db_insert_placeholder_4] => 554 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1391078029 ) in drupal_write_record() (line 7166 of /home/gregory/V3D/EqualOne_v19/www/includes/common.inc).
Maybe is it a regression ?
Comment #18
nikolaosinlight CreditAttribution: nikolaosinlight commentedI just hit this bug on latest Drupal 7.
Drupal version 7.38
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://user/photos/tmp/1/7df3h38zabcvjylnyfe3.png' for key 'uri': 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] => 0 [:db_insert_placeholder_1] => 7df3h38zabcvjylnyfe3.png [:db_insert_placeholder_2] => public://user/photos/tmp/1/7df3h38zabcvjylnyfe3.png [:db_insert_placeholder_3] => image/png [:db_insert_placeholder_4] => 559959 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1437028927 ) in drupal_write_record() (line 7326 of /sw/company/website/deployment/drupal7/includes/common.inc).
I produced it by re-uploading the file about 5 times. I setup a tmp folder with tmp/[0-9] dirs and normally cleanup the tmp file at the end of the upload however the process is 2 step... step 1 upload the file... step 2 crop the file, save new version and clear temp.
So if someone uploads a file on step 1... and then at step 2 goes back and uploads the same file... they will eventually hit this bug. I say eventually because it does not happen as often as one would expect (it appears to be intermittent).
My code is as follows:
Since FILE_EXISTS_RENAME is being passed in then the expectation is that the uploaded file will be renamed if the munged file is the same as an existing file. However that is not what appears to have happened.
UPDATE:
Just did some research and looked through the:
file_save_upload
-> calls file_destination($destination, FILE_EXISTS_RENAME)
-> calls file_create_filename($basename, $directory) (to create a unique file name)
-> calls file_exists($destination)
In looking at file_exists it is purported by someone to return FALSE for streams!
http://php.net/manual/en/function.file-exists.php
Comment #19
sj.suraj CreditAttribution: sj.suraj commentedhey
please help me for multiple file upload with ajax as it is done in this form. I want the same one. Please help me for this.