gpt4 book ai didi

javascript - 如何触发 Uploadify onError 事件处理程序?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:29:07 24 4
gpt4 key购买 nike

我正在使用 Uploadify上传文件。问题是,我需要在处理这些文件期间通知用户任何错误。

Uploadify 有 onErroronCompleteonAllComplete 事件处理程序,但我不知道如何触发这些事件以便通知用户发生了什么事。

我需要发送 JSON 字符串吗?有线索hereherehere但我无法让它工作。也许论坛上的帖子已经过时了。

有人有适用于 Uploadify 2.1 的示例吗?

最佳答案

onError 进入 uploadify 的选项:

$("#fileInput").uploadify({
onError: function(e, q, f, o) {
alert("ERROR: " + o.info);
}
});

来自Documentation

A function that triggers when an error occurs during the upload process. The default event handler attaches an error message to the queue item returning the error and changes it’s queue item container to red.

Four arguments are sent to the function:

  • event: The event object.
  • queueID: The unique identifier of the file that returned an error.
  • fileObj: An object containing details about the file that was selected.
    • name – The name of the file
    • size – The size in bytes of the file
    • creationDate – The date the file was created
    • modificationDate – The last date the file was modified
    • type – The file extension beginning with a ‘.’
  • errorObj: An object containing details about the error returned.
    • type – Either ‘HTTP’, ‘IO’, or ‘Security’
    • info – An error message describing the type of error returned

关于javascript - 如何触发 Uploadify onError 事件处理程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2036296/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com