From ffac2852d345df35390e5e912b90f36ff84f939e Mon Sep 17 00:00:00 2001 From: revagomes Date: Mon, 28 Oct 2013 16:01:16 -0200 Subject: [PATCH] Issue #1163740 by revagomes, denison: Fixed PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed()}. --- includes/file.inc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/file.inc b/includes/file.inc index 44e3422..9ece596 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -1197,9 +1197,8 @@ function file_create_filename($basename, $directory) { $ext = ''; } - $counter = 0; do { - $destination = $directory . $separator . $name . '_' . $counter++ . $ext; + $destination = $directory . $separator . $name . '_' . time() . $ext; } while (file_exists($destination)); } -- 1.8.3.2