How to display error message of jquery dropzone

前端 未结 3 1015
时光说笑
时光说笑 2021-02-12 11:26

I use dropzone with CI, i don\'t know how to display error message and custom message when upload false, this is my script

Dropzone.autoDiscover = false;
               


        
3条回答
  •  情歌与酒
    2021-02-12 11:57

    For anyone in need:

    You can return a response message from the server using echo. Then in the js code add an error event handler

    PHP

    header("HTTP/1.0 400 Bad Request");
    echo "Ups error message";
    

    JS

    this.on('error', function(file, response) {
        $(file.previewElement).find('.dz-error-message').text(response);
    });
    

提交回复
热议问题