Uploadify uploading Files (2)--Basic syntax

Source: Internet
Author: User
Tags html file upload unique id jquery library

Separated for a long time, because recently moved, left the city of small life, came to Hangzhou. Looking for a job, looking for a house and many other issues delayed this article for a long time. It's a rare day in a hotel. Complete the Uploadify upload file series in the second--uploadify use the underlying syntax.

Let's take a look at how to deploy uploadify on your project:

This article directory:

1. Steps to use

2. Properties

3. Events

4. Methods

Use Step 1. We assume that the upload control is deployed in the upload of the site root directory.

PHP, the Uploadify folder is located in the root directory of the site, the uploaded files are saved in the root directory in the Upload folder, Uploadify folder contains check-exists.php, Jquery.min.js, Jquery.uploadify.min.js, Uploadify.css, uploadify.swf, Uploadify-cancel.png.

2. Referencing the jquery library

<script type= "Text/javascript" src= "/uploadify/jquery.min.js" ></script>

3. Referencing the uploadify script

<script type= "Text/javascript" src= "/uploadify/jquery.uploadify.min.js" ></script>

4. Referencing the uploadify style sheet

<link rel= "stylesheet" type= "Text/css" href= "Uploadify.css"/>

5. Declare an ordinary HTML file upload control and specify the ID

<input id= "File_upload" name= "file_upload" type= "file" multiple= "true" >

6. Bind the declared normal upload control to the Uploadify plug-in and initialize the

<script type= "Text/javascript" > $ (Function () {$ (' #file_upload '). Uploadify ({' swf ': '/UPL Oadify uploadify.swf ',//Specify the main file of the upload Control ' uploader ': '/uploadify uploadify.php '//Specify server-side upload processing file//    Other configuration items}); });</script>

Property

Auto Boolean type

Set auto to True to automatically upload files when they are added to the upload queue.

Buttonclass String

Add the class name for the upload button.

buttoncursor String

The mouse's shape when the mouse passes the upload button. The optional values are ' hand ' (hand-shaped) and ' arrow ' (arrows).

buttonimage String

Defines the path of the browse button background image. The code that sets the background image for the button is best written in a CSS file.

ButtonText String

Defines the text that is displayed on the default button.

checkexisting String

Defines the path to the script file that checks whether a file with the same name exists in the destination folder.

Debug Boolean type

When its value is true, the SWFUpload debug mode is turned on.

fileobjname String

Defines the name of the file object used to receive data in the Upload data processing file.

filesizelimit Integral type

Upload file size limit.

Filetypedesc String

A description of the file types that can be selected. This string appears in the File Type drop-down menu of the Browse for File dialog box.

filetypeexts String

Defines the file suffixes that are allowed to be uploaded.

FormData JSON object

Define additional data objects that need to be submitted together when the file is uploaded.

Height integral type

The height of the upload button (in pixels).

itemTemplate Boolean type

The ItemTemplate option allows you to set a different HTML template for each option added to the queue.

Method String

Upload the file submission method, take value ' post ' or ' get '.

Multi Boolean type

When the value is set to False, only one file can be selected at a time.

overrideevents Json

This item defines a set of event names in the default script that you do not want to perform.

preventcaching Boolean type

If set to true, a random value is added to the URL of the SWF file, so it is not cached.

progressdata String

Sets the type of data that is displayed in the upload progress bar, either as a percentage (percentage) or as a velocity (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 Integral type

The maximum number of bars that can be accommodated at one time in the upload queue.

removecompleted Boolean type

Not setting this option or setting it to false will cause items in the upload queue to always appear in the queue until the Close button is clicked or the queue is emptied.

removetimeout Integral type

Sets the time (in seconds) to remove from the upload queue when the upload is complete.

requeueerrors Boolean type

When set to True, an error message is returned when the upload queue resets or uploads multiple retries.

successtimeout Integral type

Indicates the successful wait time (in seconds, default 30 seconds) for uploadify.

swf string

Defines the path to the uploadify.swf.

Uploader String

Defines the path to the server-side upload data processing script file uploadify.swf.

uploadlimit Integral type

Defines the maximum number of uploads allowed.

width integral type

Defines the width of the browse button.

Event

OnCancel function

Set the OnCancel option to allow a custom function to run when the file upload is canceled.

Onclearqueue function

Setting the Onclearqueue option allows a custom function to run when the upload queue is emptied (activating the Ancel method).

OnDestroy function

The event is triggered when the Uploadify instance is destroyed (called the Destroy method).

ondialogclose function

This event is triggered when the Browse File dialog box is closed. If the event is added to the Overrideevents property, the default error message will not pop up when an error occurs in adding files to the queue.

Ondialogopen function

The event is triggered before the Browse File dialog box is opened.

ondisable function

The event is triggered when the Disable method is called to disable an uploadify instance.

onenable function

The event is triggered when the Disable method is called to enable the Uploadify instance.

Onfallback function

The event is triggered when the browser detects a compatible version of Flash.

onInit function

The event is triggered at the end of the call to Uploadify initialization.

Onqueuecomplete function

This event is triggered when all the files in the queue are processed.

OnSelect function

This event is triggered every time a file is added to the upload queue.

Onselecterror function

The event is triggered when a file return error is selected. Each file that returns an error triggers the event.

Onswfready function

This event is triggered when the Flash button is loaded.

Onuploadcomplete function

Each file upload completes, triggering the event, whether the upload succeeds or the upload fails.

Onuploaderror function

This event is triggered when an upload fails.

onuploadprogress function

The event is triggered when the upload progress update occurs.

Onuploadstart function

The event is triggered immediately before the upload is started.

onuploadsuccess function

This event is triggered when each file upload succeeds.

Method

Cancel

Cancels the upload object.

Destroy

Destroys the Uploadify instance and returns the original file field.

Disable

Controls whether the browse button is available.

Settings

Returns or updates the value of a uploadify instance.

Stop

Stops the current upload.

Upload

Uploads all files in the specified file or queue.

This article refers to the self-code fan, has made some modifications.

Uploadify uploading Files (2)--Basic syntax

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.