//this function will upload file through ajax
add: function (e, data) {
//before upload file check server has that file already uploaded
$.ajax(
{
type: "POST",
dataType:'json',
url:"../admin/cgi/file_check.php",
async:false,
data:{
filename : upload_filename,
docname : upload_docname,
userid : upload_userid,
},
success:function(data)
{
//check file alreay exists
if(data['doc_name'] == 'invalid')
{
// if file alreay exists want to stop upload process
//exit from main funtion
}
},
error:function(request,errorType,errorMessage)
{
alert ('error - '+errorType+'with message - '+errorMessage);
}
});
//file uploading code
}
add: function (e, data) {}
- main function upload file through ajax
before upload check server has that file already uploaded through ajax request
if file alreay exists ajax success call back return the value data['doc_name'] = 'invalid'
if file alredy exists if(data['doc_name'] == 'invalid')
i want to stop uploading proccess (want to exit from main uploading function)