Uploadify/uploadifive upload (Chinese document), uploadify Chinese Document
Uploadify is an excellent JQuery-based file/Image Upload plug-in. It is based on Flash and HTML5.
Uploadify/uploadifive has the following main features:
1. Multifile upload
2. personalized settings
3. Upload progress bar display
4. Drag and Drop upload (HTML5 Version)
Official Website: http://www.uploadify.com
Deployment
Before deploying an Uploadify instance, make sure that the following minimum requirements are met:
- 1. jQuery 1.4.x or later
- 2. Flash Player 9.0.24 or later
- 3. Support for PHP, ASP. Net, and Cold Fusion server environments (official support for PHP by default)
Download the latest version of uploadify and decompress it to the uploadify folder under the root directory of the server. You can see the following files:
- Change Log.txt (uploadify upgrade log, deleted during deployment)
- Check-exists.php (used to check whether the same file exists in the upload destination folder)
- Index. php (Official instance)
- Jquery. uploadify. js (upload plug-in)
- Jquery. uploadify. min. js (compressed version of the upload plug-in, used for deployment)
- License.txt (license file, deleted during deployment)
- Uploadify.css (upload control style sheet)
- Uploadify. php (upload a data processing file)
- Uploadify.swf (Basic flash file)
- Uploadify-cancel.png (cancel button picture)
In the instance files officially provided, the jquery library is referenced on the official jquery website. If you need it, you need to reference the jquery library locally.
Next, let's take a look at how to deploy uploadify on your project:
1. assume that the upload control is deployed under the root directory of the website. in php, The uploadify folder is located in the website root directory, the uploaded files are stored in the upload folder under the root directory, the uploadify folder contains check-exists.php, jquery. min. js pipeline jquery.uploadify.min.js?uploadify.css=uploadify.swf=uploadify-cancel.png.
2. Reference The jquery Library
- <Script type = "text/javascript" src = "/uploadify/jquery. min. js"> </script>
3. Reference The uploadify script
- <Script type = "text/javascript" src = "/uploadify/jquery. uploadify. min. js"> </script>
4. Reference The uploadify style sheet
- <Link rel = "stylesheet" type = "text/css" href = "uploadify.css"/>
5. Declare a common html file upload control and specify the id
- <Input id = "file_upload" name = "file_upload" type = "file" multiple = "true">
6. Bind the declared General upload control to the Uploadify plug-in and initialize it.
- <Script type = "text/javascript">
- $ (Function (){
- $ ('# File_upload'). uploadify ({
- 'Swf ':'/uploadify uploadify.swf ', // specifies the main file of the upload control.
- 'Upload': '/uploadify. php' // specify the server to upload and process files.
- // Other configuration items
- });
- });
- </Script>
Attribute
Auto Boolean
Set auto to true. When a file is added to the upload queue, it is automatically uploaded.
ButtonClass string
Add a class name for the upload button.
ButtonCursor string
The shape of the mouse when the mouse passes the upload button. Optional values: 'hand' and 'arrow ).
ButtonImage string
Define the path of the "Browse" button background image. It is best to write the code for setting the background image for the button in the CSS file.
ButtonText string
Defines the text displayed on the default button.
CheckExisting string
Define whether the script file path of the file with the same name exists in the target folder.
Debug Boolean
When its value is true, the SWFUpload debugging mode is enabled.
FileObjName string
Defines the name of the object used to receive data in the uploaded data processing file.
FileSizeLimit integer
Size Limit of uploaded files.
FileTypeDesc string
Description of the file type that can be selected. This string appears in the file type drop-down menu of the Browse File Dialog Box.
FileTypeExts string
Specifies the suffix of a file that can be uploaded.
FormDataJSON object
Defines other data objects that need to be submitted together during file upload.
Height integer
The height of the upload button (unit: pixels ).
ItemTemplate Boolean
The itemTemplate option allows you to set a different HTML template for each option added to the queue.
Method string
The submission method for uploading files. The value is 'post' or 'get '.
Multi Boolean
When the value is set to false, only one file can be selected at a time.
OverrideEventsJSON
This defines the names of events you do not want to execute in a set of default scripts.
PreventCaching Boolean
If it is set to true, a random value is added to the URL of the SWF file, so it will not be cached.
ProgressData string
Sets the Data Type displayed in the upload progress bar. The value can be either a percent or a speed ).
QueueID string
The queueID option allows you to set a DOM element with a unique ID as a container for displaying the upload queue.
QueueSizeLimit integer
Maximum number of items that can be accommodated in an upload queue.
RemoveCompleted Boolean
If this option is not set or set to false, items in the upload queue are always displayed in the queue until the close button is clicked or the queue is cleared.
RemoveTimeout integer
Set the time (in seconds) for removing data from the upload queue after the upload is complete ).
RequeueErrors Boolean
If this parameter is set to true, an error message is returned when the upload queue is reset or when the upload is retried multiple times.
SuccessTimeout integer
Indicates the waiting time for uploadify to succeed (unit: seconds, default: 30 seconds ).
Swf string
Define the path of uploadify.swf.
Uploader string
Define the path of the uploadify.swf file of the data processing script uploaded to the server.
UploadLimit integer
Defines the maximum number of uploads allowed.
Width integer
Defines the width of the browser button.
Event
OnCancel Function
Set the onCancel option. When the file upload is canceled, a user-defined function can be run.
OnClearQueue Function
Set the onClearQueue option. When the upload queue is cleared (the ancel method is activated), a user-defined function can be run.
OnDestroy Function
This event is triggered when the Uploadify instance is destroyed (the destroy method is called.
OnDialogClose Function
This event is triggered when the Browse File Dialog box is closed. If the event is added to the overrideEvents attribute, the default error message is not displayed when an error occurs when the file is added to the queue.
OnDialogOpen Function
This event is triggered immediately before the file browsing dialog box is opened.
OnDisable Function
This event is triggered when the disable method is called to disable the Uploadify instance.
OnEnable Function
This event is triggered when the disable method is called to enable the Uploadify instance.
OnFallback Function
This event is triggered when the browser detects a compatible version of Flash.
OnInit Function
This event is triggered when Uploadify is called and initialization ends.
OnQueueComplete Function
This event is triggered when all files in the queue are processed.
OnSelect Function
This event is triggered every time a file is added to the upload queue.
OnSelectError Function
This event is triggered when an error is returned when a file is selected. This event is triggered when an error is returned for each file.
OnSWFReady Function
This event is triggered when the flash button is loaded.
OnUploadComplete Function
This event is triggered after each file upload is complete, whether the upload is successful or the upload fails.
OnUploadError Function
This event is triggered when the upload fails.
OnUploadProgress Function
This event is triggered when the upload progress is updated.
OnUploadStart Function
This event is triggered instantly before the upload starts.
OnUploadSuccess Function
This event is triggered when each file is uploaded successfully.
Method
Cancel
Cancel object upload.
Destroy
Destroys the Uploadify instance and returns the original file domain.
Disable
Controls whether the Browse button is available.
Settings
Returns or updates the value of an Uploadify instance.
Stop
Stop the current upload.
Upload
Upload All files in a specified file or queue.