src/Components/Corp-CandidateRegistration/CandidateRegistration.js
//------------file type checking before uploading file-------------

file type checking before uploading file
file type checking before uploading file
checkFileType(event) {
        fileArr = []
        var file = event.target.files[0]
        if (!(file == undefined)) {
            if (file.type == "application/pdf" ||
                file.type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ||
                file.type == "application/msword" ||
                file.type == "text/plain") {
                this.setState({ FileUploadError: "" })
                fileArr.push(file)
                console.log(fileArr)
            }
            else {
                this.setState({ FileUploadError: "Please upload file with extension .doc,.docx,.pdf,.txt only." })
            }
        }
        else {
            this.setState({ FileUploadError: "Please Select a file." })
        }
    }
checkFileType ( event ) { fileArr = [ ] var file = event . target . files [ 0 ] if ( ! ( file == undefined ) ) { if ( file . type == "application/pdf" || file . type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || file . type == "application/msword" || file . type == "text/plain" ) { this . setState ( { FileUploadError : "" } ) fileArr . push ( file ) console . log ( fileArr ) } else { this . setState ( { FileUploadError : "Please upload file with extension .doc,.docx,.pdf,.txt only." } ) } } else { this . setState ( { FileUploadError : "Please Select a file." } ) } }
file type checking before uploading file
file type checking before uploading file