Uploadify 3.0 detailed instructions

Source: Internet
Author: User

Usage:
Copy codeThe Code is as follows:
// Bind the Interface Element <input id = 'gallery 'Type = 'file'/>
$ ("# Gallery"). uploadify ({
Set parameters as follows.
});

Set attributes:
Copy codeThe Code is as follows:
Id: jQuery (this). attr ('id'), // id of the bound input
LangFile: 'http: // www. static-xxx.nu/uploader/uploadifyLang_en.js ', // Language Pack path, can set all the prompt text
Swf: 'http: // www. static-xxx.nu/uploader/uploadify.swf ', // [required] swf path
Uploader: '/uploadify/galleri. php', // [required] url triggered by File Upload
Auto: false, // whether to automatically upload the file after the file is selected
ButtonText: 'välj Filer ', // Text of the upload button
Height: 30, // the height and width of the upload button
Width: 120,
ButtonCursor: 'pointer ', // the shape of the Cursor after uploading the mouse hover
CancelImage: '/upload/201206/20120618142325932 .png', // [required] cancel image path
CheckExisting: '/uploader/uploadify-check-existing.php', // check whether the uploaded file is saved, trigger url, return 1/0
Debug: true, // debug mode on/off. The debug information is displayed when it is enabled.
FileObjName: 'file ',
FileSizeLimit: 0, // maximum file size, in bytes, 0 is not limited. 1 MB: 1*1024*1024
FileTypeDesc: 'bild JPG ', // description of the file type that can be uploaded, which is displayed in the pop-up file selection box.
FileTypeExts: '*. jpg', // specifies the file type that can be uploaded, and specifies the files that can be selected in the pop-up file selection box.
Method: 'post', // method for interacting with the background: post/get
Multi: true, // whether multiple files can be selected
QueueID: 'filequeue ', // displays the element id of the Upload File queue, which can be simply displayed using a div.
QueueSizeLimit: 999, // maximum number of files allowed in the queue
ProgressData: 'all', // 'centage' 'speed' 'all' // The method for displaying the File Upload progress in the queue: all-upload speed + percentage, percentage-percentage, speed-upload speed
RemoveCompleted: true, // whether the uploaded files are automatically deleted in the queue
RemoveTimeout: 3,
RequeueErrors: true,
PostData :{}, // additional parameters when interacting with the background
PreventCaching: true,
Transparent: true,
SuccessTimeout: 30, // timeout during upload
UploadLimit: 999 // number of files that can be uploaded simultaneously

Set events:
Copy codeThe Code is as follows:
OnDialogClose: function (swfuploadifyQueue) {// triggered when the file selection dialog box is closed
If (swfuploadifyQueue. filesErrored> 0 ){
Alert ('when added to the queue'
+ SwfuploadifyQueue. filesErrored
+ 'File errors N'
+ 'Error message :'
+ SwfuploadifyQueue. errorMsg
+ 'N' number of selected files :'
+ SwfuploadifyQueue. filesSelected
+ 'N' number of files successfully added to the queue :'
+ SwfuploadifyQueue. filesQueued
+ 'N' total number of files in the queue :'
+ SwfuploadifyQueue. queueLength );
}
}
OnDialogOpen: function () {// triggered when the select file dialog box is opened
Alert ('Open! ');
}

OnSelect: function (file) {// triggered when each file is added to the queue
Alert ('Id: '+ file. id
+ '-Index:' + file. index
+ '-File name:' + file. name
+ '-File size:' + file. size
+ '-Type:' + file. type
+ '-Creation date:' + file. creationdate
+ '-Modification date:' + file. modificationdate
+ '-File status:' + file. filestatus );
}

OnSelectError: function (file, errorCode, errorMsg) {// triggered when an error occurs during file selection
Alert ('Id: '+ file. id
+ '-Index:' + file. index
+ '-File name:' + file. name
+ '-File size:' + file. size
+ '-Type:' + file. type
+ '-Creation date:' + file. creationdate
+ '-Modification date:' + file. modificationdate
+ '-File status:' + file. filestatus
+ '-Error code:' + errorCode
+ '-Error message:' + errorMsg );
}

OnQueueComplete: function (stats) {// triggered when all files in the queue are uploaded
Alert ('number of successfully uploaded files: '+ stats. successful_uploads
+ '-Number of files with an upload error:' + stats. upload_errors
+ '-Number of unuploaded files:' + stats. upload_cancelled
+ '-Number of files in error' + stats. queue_errors );
}

OnUploadComplete: function (file, swfuploadifyQueue) {// triggered once each file in the queue is uploaded
Alert ('Id: '+ file. id
+ '-Index:' + file. index
+ '-File name:' + file. name
+ '-File size:' + file. size
+ '-Type:' + file. type
+ '-Creation date:' + file. creationdate
+ '-Modification date:' + file. modificationdate
+ '-File status:' + file. filestatus
+ '-Number of failed files:' + swfuploadifyQueue. filesErrored
+ '-Error message:' + swfuploadifyQueue. errorMsg
+ '-Number of queues to be added:' + swfuploadifyQueue. filesSelected
+ '-Number of opposites added:' + swfuploadifyQueue. filesQueued
+ '-Queue length:' + swfuploadifyQueue. queueLength );
}

OnUploadError: function (file, errorCode, errorMsg, errorString, swfuploadifyQueue) {// if an error occurs during file Upload (trigger each file with an error)
Alert ('Id: '+ file. id
+ '-Index:' + file. index
+ '-File name:' + file. name
+ '-File size:' + file. size
+ '-Type:' + file. type
+ '-Creation date:' + file. creationdate
+ '-Modification date:' + file. modificationdate
+ '-File status:' + file. filestatus
+ '-Error code:' + errorCode
+ '-Error Description:' + errorMsg
+ '-Brief error Description:' + errorString
+ '-Number of failed files:' + swfuploadifyQueue. filesErrored
+ '-Error message:' + swfuploadifyQueue. errorMsg
+ '-Number of queues to be added:' + swfuploadifyQueue. filesSelected
+ '-Number of opposites added:' + swfuploadifyQueue. filesQueued
+ '-Queue length:' + swfuploadifyQueue. queueLength );
}

OnUploadProgress: function (file, fileBytesLoaded, fileTotalBytes,
QueueBytesLoaded, swfuploadifyQueueUploadSize) {// triggered when the upload progress changes
Alert ('Id: '+ file. id
+ '-Index:' + file. index
+ '-File name:' + file. name
+ '-File size:' + file. size
+ '-Type:' + file. type
+ '-Creation date:' + file. creationdate
+ '-Modification date:' + file. modificationdate
+ '-File status:' + file. filestatus
+ '-The current file has been uploaded:' + fileBytesLoaded
+ '-Current file size:' + fileTotalBytes
+ '-The queue has been uploaded:' + queueBytesLoaded
+ '-Queue size:' + swfuploadifyQueueUploadSize );
}

OnUploadStart: function (file) {// triggered when the upload starts (each file is triggered once)
Alert ('Id: '+ file. id
+ '-Index:' + file. index
+ '-File name:' + file. name
+ '-File size:' + file. size
+ '-Type:' + file. type
+ '-Creation date:' + file. creationdate
+ '-Modification date:' + file. modificationdate
+ '-File status:' + file. filestatus );
}

OnUploadSuccess: function (file, data, response) {// triggered when the upload is complete (each file is triggered once)
Alert ('Id: '+ file. id
+ '-Index:' + file. index
+ '-File name:' + file. name
+ '-File size:' + file. size
+ '-Type:' + file. type
+ '-Creation date:' + file. creationdate
+ '-Modification date:' + file. modificationdate
+ '-File status:' + file. filestatus
+ '-Server-side message:' + data
+ '-Whether the upload is successful:' + response );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.