[![Uploadify - JQuery File Upload Plugin Script](https://box.kancloud.cn/2015-11-02_5636cc82d8b6c.png)](http://www.uploadify.com)
# onError
Input Type:**function**
Input Format:**function(event,ID,fileObj,errorObj) {}**
Required:**optional**
The **onError** option allows you to fire a custom function when an error is returned during upload. The default function add the error class to the file queue item. If your custom function returns **false**, the default function will not run.
### Arguments
**event
**The event object.
**ID
**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
### Demo
Javascript Code
1.
$('#file_upload').uploadify({
1.
'uploader' : '/uploadify/uploadify.swf',
1.
// Point to a non-existent back-end file so the error always triggers.
1.
'script' : '/uploadify/uploadify-x.php',
1.
'cancelImg' : '/uploadify/cancel.png',
1.
'folder' : '/uploads',
1.
'onError' : function(event,ID,fileObj,errorObj){
1.
alert(errorObj.type + ' Error: ' + errorObj.info);
1.
}
1.
});
HTML Code
1.
<inputtype="file"id="file_upload"name="file_upload"/>
1.
<ahref="javascript:$('#file_upload').uploadifyUpload();">Upload Files</a>
[Upload Files](#)
[![Download the Latest Version](https://box.kancloud.cn/2015-11-02_5636cc82ea7d9.png)](#)
Help keep Uploadify free and support the development of other excellent apps!
![](../image/564003e13d482.gif)
[home](#) | [about](#) | [download](#) | [demos](#) | [documentation](#) | [faqs](#) | [forums](#)
©2011 by [Reactive Apps](http://www.reactiveapps.com)
- Uploadify Documentation API
- events
- onallcomplete - function(event,data)
- onCancel - function(event,ID,fileObj,data)
- onCheck - function()
- onClearQueue - function(event)
- onComplete - function(event, ID, fileObj, response, data)
- onError - function(event,ID,fileObj,errorObj)
- onInit - function()
- onOpen - function(event,ID,fileObj)
- onProgress - function(event,ID,fileObj,data)
- onQueueFull - function(event,queueSizeLimit)
- onSelect - function(event,ID,fileObj)
- onSelectOnce - function(event,data)
- onSWFReady - function()
- methods
- uploadify(options)
- uploadifyCancel(ID)
- uploadifyClearQueue()
- uploadifySettings(name,value,resetObject)
- uploadifyUpload(ID)
- options
- auto
- buttonImg
- buttonText
- cancelimg
- checkscript
- displayData
- expressInstall
- fileDataName
- fileDesc
- fileExt
- folder
- height
- hideButton
- method
- multi
- queueID
- queueSizeLimit
- removeCompleted
- rollover
- script
- scriptAccess
- scriptData
- simUploadLimit
- sizeLimit
- uploader
- uploadify API-ZH-CN.html
- width
- wmode