我应该返回什么以在blueimp/jquery.file-upload-ui的delete事件上显示错误消息 [英] What should I return in response to show error message on delete event for blueimp/jquery.file-upload-ui

查看:89
本文介绍了我应该返回什么以在blueimp/jquery.file-upload-ui的delete事件上显示错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 https://github.com上的jQuery文件上载jQuery UI插件8.7.2. /blueimp/jQuery-File-Upload 文件的上传和删除成功完成. 但是在服务器端未正确完成文件删除时,我应该返回什么以响应JSON来显示错误.例如,用户对此无权访问.

I am using jQuery File Upload jQuery UI Plugin 8.7.2 from https://github.com/blueimp/jQuery-File-Upload Uploading and deleting of files work successfully. But what should I return in response JSON to show error when deleting of file not finished correctly on server side. For example user have not access for this.

这是我的PHP代码:

$response = json_encode(
    (object)
    [ 'files' =>
        [
            $file->filename => true,
        ]
    ]
);
return $response;

推荐答案

UI插件似乎对响应没有任何作用,因此您需要修改 jquery.fileupload-ui.js 代码,以便对错误做出响应.

The UI plugin doesn't seem to do anything with the response so you'd need to modify the jquery.fileupload-ui.js code in order to do something with an error response.

这篇关于我应该返回什么以在blueimp/jquery.file-upload-ui的delete事件上显示错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆