0

I am doing the following steps to upload the file. But it is accepting all types of files.I want to restrict to do .pdf and .doc alone. How to do ?

My code

<input type="file" id="Resume"/>

Jquery

Candidate.AddUploadResumeBehavior = function () {
$('#Resume').uploadify({ 
    'swf': root + '/Content/Flash/uploadify.swf',
    'uploader': root + '/Candidates/UploadResume',
    'cancelImg': root + '/Content/Images/uploadify-cancel.png',
    'auto': true,
    'multi': true,
    'fileDesc': 'Image Files',
    'fileExt': '*.jpg;*.png;*.gif;*.pdf;*.bmp;*.jpeg;*.doc',
    'queueSizeLimit': 90,
    'sizeLimit': 4000000,
    'buttonText': 'Upload Resume',
    'width': 200,
    'folder': root + '/uploads',
    'onComplete': function (event, queueID, fileObj, response, data) {
        Dial4Jobz.Common.ShowMessageBar("Resume has been uploaded.");
    },
    'onError': function (event, ID, fileObj, errorObj) {
        var msg;
        if (errorObj.type === "File Size")
            msg = 'File size cannot exceed 4MB';
        else
            msg = "An error occured while attempting to uploading resume."

        Common.ShowMessageBar(msg);
        this.hide();
    }
});

};

Here i have tried to change the extensions files '*.jpg;*.png;*.gif;*.pdf;*.bmp;*.jpeg;*.doc' into '*.doc; *.pdf'. But it is not changed. how to do this?

2 Answers 2

1

I think this should fix your issue :

'fileTypeExts' : '*.gif; *.jpg; *.png'.....

Instead of "fileExt" use "fileTypeExts" and your issue shall be fixed..

Sign up to request clarification or add additional context in comments.

Comments

0

Implement the onSelect callback function and check every file for its type. Remove files with invalid types by calling

$jQuery('#uploadify').uploadifyCancel(queueID)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.