Skip to Content

FileUploader typeMissmatch work around

Finally managed to get that FileUploader to work.

Seems that the API you get at RT is not the same as what is published

Anyway, I couldn’t use the onTypeMissmatch API so I had to write a work around:

     importSite: function importSite() {

            var fileExtension = this.fileUploader.getProperty(“value”).toString();

            var fileNameLength = fileExtension.length;

//            verify the file extension before posting to the server – work around for the onTypeMissmatch api

            if (fileExtension.substring(fileNameLength-3,fileNameLength) !== “zip”){

                this.showError(“Only zip files are supported”));

            } else{

              

                this.fileUploader.upload();

            }

        },

I know this is not really a proper file type validation, but I had to start with something…

Wish these things were a little more straight forward 🙂

I also put it on snipix.

byg

Be the first to leave a comment
You must be Logged on to comment or reply to a post.