I want to create an aspx file where I will have a tab to upload a file in SharePoint Online library. On upload, I want to check whether the file title is having the correct format or not. If file is not having the right format, I have to request user to check for the format. So, can some one help me with this?
Sample regex for file type validation, hope it would help you.
// Get test values from the file input and text input page controls. var fileInput = jQuery('#getFile'); var newName = jQuery('#displayName').val(); var parts = fileInput.value.split('\\'); var fileName = parts[parts.length - 1]; var fileRegex = new RegExp('\.[^.\\/:*?"<>|\r\n]+$'); var fileType = fileName.match(fileRegex); //todo
You could use official demo to upload file(above test demo is based on official demo also).