Allowed File Extensions

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 31, 2019   (RSS)

By gversion - October 24, 2019


I am creating an upload field for a form. I would like to be able to use a JavaScript function that checks the allowed extensions.

Currently I am hardcoding the allowed file types:

		var types = ['application/','application/msword','application/pdf','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/vnd.openxmlformats-officedocument.wordprocessingml.document'];
		for(var i=0;i<fs;i++){
	  	if(types.toString().indexOf(files[i].type) == -1) {
	  		error += 'Disallowed file type\n';

I would like to improve this by allowing the file types defined in cmsb section editor area but I am not sure how to access this array.

Can someone please advise?

Thank you,


By gversion - October 31, 2019

Hi Daniel,

As always, you've been extremely helpful - thank you very much!