Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Installed Drupal 7 using the Web Platform installer on Windows 2008

For some reason, the file module, when you upload a file, uses the first few letters of the filename as the unique key to store in the database, which of course causes problems very fast.

I'm wondering does anybody have a workaround for this?

An AJAX HTTP request terminated abnormally. Debugging information follows. 

Path: /file/ajax/field_file/und/0/form-EBMatHzV5cZXcWvXJtdADSdyw7Id9-GIpFM_NCJg_a4 

StatusText: n/a 

ResponseText:  Error message PDOException: SQLSTATE[23000]: [Microsoft][SQL Server Native Client10.0][SQL Server]Cannot insert duplicate key row in object 'dbo.file_managed' with unique index 'uri_unique'. in drupal_write_record() (line 6776 of  ..........\includes\ Error The website encountered an unexpected error. Please try again later.   

ReadyState: undefined
share|improve this question
up vote 0 down vote accepted

I experienced exactly the same problem today. It happened when I was trying to load a new theme.

I have installed another instance of Drupal with a MySQL database to compare the tables and check if there were a calculated field there.

There was none. In MySQL the index is built on the field 'uri'

So, in my SQL server database, I moved the 'uri_unique' index from the field '__unique_uri' to the field 'uri' (like in MySQL). And it worked just fine !

I assume it's less efficient as the field is nvarchar(255) where the calculated field was a varbinary(16)... and I hope i won't be in trouble later...But at least, it solved the problem.

share|improve this answer
Similar to the solution I found where I changed the calculated field, but I think your solution might even work better. Thnx! – TimothyP Feb 16 '11 at 12:27

I just found the bug report for that problem: (There is a patch)

share|improve this answer
This issues seems to be missing now? – David Barratt May 15 '14 at 19:39

Apparently some genious inserted this in the database:

the __unique_uri in the file_managed table is a calculated field:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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