diff options
Diffstat (limited to 'apps/files/ajax/newfile.php')
-rw-r--r-- | apps/files/ajax/newfile.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php index 76c03c87a51..8f483aa5cb6 100644 --- a/apps/files/ajax/newfile.php +++ b/apps/files/ajax/newfile.php @@ -56,6 +56,21 @@ function progress($notification_code, $severity, $message, $message_code, $bytes $target = $dir.'/'.$filename; +$l10n = \OC_L10n::get('files'); + +if (\OC\Files\Filesystem::file_exists($target)) { + $result = array( + 'success' => false, + 'data' => array( + 'message' => $l10n->t( + "The name %s is already used in the folder %s. Please choose a different name.", + array($newname, $dir)) + ) + ); + OCP\JSON::error($result); + exit(); +} + if($source) { if(substr($source, 0, 8)!='https://' and substr($source, 0, 7)!='http://') { OCP\JSON::error(array("data" => array( "message" => "Not a valid source" ))); |