MediaWiki:Gadget-UploadValidation.js

// -- // Force lowercase file extensions // This ensures uploaded files have their extension in lowercase // --

function force_lowercase { $('#mw-upload-form').on('submit', function{		$("#mw-input-source, #wpUploadDescription").each(function { var valFirstChar = $(this).val.charAt(0); if (valFirstChar !== "" && valFirstChar !== " ") $(this).val( " " + $(this).val ); });		var fileName = $('#wpDestFile').val,		   ext = fileName.substring(fileName.lastIndexOf(".")+1).toLowerCase;		$('#wpDestFile').val( fileName.slice(0, -1*ext.length) + ext );	}); } $( force_lowercase );