返回false不起作用,但警报正在运行

时间:2015-07-28 08:48:22

标签: javascript jquery ajax codeigniter

当我上传大小超过1Mb的图像时,警报正在运行,图像也会上传。有人可以帮帮我吗?

$(document).on('change', '#images', function(){
    files = this.files;
    size = files[0].size;

    if (size < 1000141) { 
        return true;
        // exit();
        // end;
    }

    alert('Please upload less than 1mb file');
    return false;
    return true;
});

//to show the preview of uploaded image
function readURL(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();
        reader.onload = function (e) {
        $('#blah').attr('src', e.target.result);
        $('#blah').show();
    }

    reader.readAsDataURL(input.files[0]);
}
}

$("#images").change(function(){
    readURL(this);
});

1 个答案:

答案 0 :(得分:-1)

您在 products.productName = $http.defaults.headers.common[PROD_CONST.PROD_NAME]; if (products.productName !== 'SM_PROD') { products.productName = products.productName; } else { products.productName = ''; } 之后获得static void Main() { FileSystemWatcher w = new FileSystemWatcher(@"C:\temp"); w.Renamed += w_Renamed; w.EnableRaisingEvents = true; // Wait for the user to quit the program. Console.WriteLine("Press \'q\' to quit the sample."); while (Console.Read() != 'q') ; } static void w_Renamed(object sender, RenamedEventArgs e) { //Add your logic here } 。将其更改为如下

return true