Commit c2c394f3 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Print sensible message if a filename clash is detected at the php end

parent a3fd1487
......@@ -44,6 +44,7 @@ $string['emptyfolder'] = 'Empty folder';
$string['file'] = 'File';
$string['files'] = 'files';
$string['fileexists'] = 'File exists';
$string['fileexistsonserver'] = 'A file with the name %s already exists.';
$string['fileexistsoverwritecancel'] = 'A file with that name already exists. You can try a different name, or overwrite the existing file.';
$string['filelistloaded'] = 'File list loaded';
$string['filenamefieldisrequired'] = 'The file field is required';
......
......@@ -58,7 +58,10 @@ if ($oldid = ArtefactTypeFileBase::file_exists($title, $data->owner, $parentfold
$obj->delete();
}
else {
// Hopefully this will happen rarely as filename clashes are
// detected in the javascript.
$result->error = 'fileexists';
$result->message = get_string('fileexistsonserver', 'artefact.file', $title);
}
}
if (!isset($result->error)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment