These two days with the uploaded control, php+jquery today to introduce this uploadify, well, I download today because my English is not very good so I look for the use of the online tutorial, I found that a lot of use, I go, you see the official document is not a lot of APIs are not the previous API. Today summed up for everyone, to give everyone a reminder or to see the official http://www.uploadify.com/documentation/!
The simple example uses then I all to add the annotation to everybody, the convenience everybody reads and uses the downloading official after the direct use to be OK, certainly what you need in the direct modification on can!
Copy Code code as follows:
<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>uploadify explanation </title>
<script src= "Http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type= "Text/javascript" ></ Script>
<script src= "Jquery.uploadify.min.js" type= "Text/javascript" ></script>
<link rel= "stylesheet" type= "Text/css" href= "Uploadify.css" >
<style type= "Text/css" >
Body {
Font:13px Arial, Helvetica, Sans-serif;
}
</style>
<body>
<form>
<div id= "queue" ></div>
<input id= "File_upload" name= "file_upload" type= "file" multiple= "true" >
</form>
<script type= "Text/javascript" >
<?php $timestamp = time ();? >
$ (function () {
$ (' #file_upload '). Uploadify ({
Post data when uploading files
' FormData ': {
' Timestamp ': ' <?php echo $timestamp;? > ',
' token ': ' <?php echo MD5 (' Unique_salt '. $timestamp);? > ',
' ID ': 1
},
' swf ': '/uploadify/uploadify.swf ',
' Uploader ': ' http://localhost/uploadify/uploadify.php ',
' OnInit ': function (index) {
Alert (' Queue ID: ' +index.settings.queueid);
},
' method ': ' Post ',//Set upload methods Get and post
' Auto ': false,//whether automatically upload false turn off automatic upload true Select file automatically upload
' Buttonclass ': ' MyClass ',//custom button style
' Buttonimage ': ' button picture ',
' ButtonText ': ' Select File ',///button to display the handwriting
' Fileobjname ': ' mytest '//Backstage reception is $_files[' mytest '
' checkexisting ': '/uploadify/check-exists.php ', check if file already exists return 0 or 1
' Filesizelimit ': ' 100KB ',//upload file size limit
' Filetypedesc ': ' You need some files ',//The description of the selectable file
' filetypeexts ': ' *.gif; *.jpg; *.png ',//file type of allowed upload
Events that occurred while uploading.
' Onuploadstart ': function (file) {
Alert (' Start uploading '); },
' Uploadlimit ': 5,//Set maximum number of uploaded files
/*
' Onuploadcomplete ': function (Result) {
for (var i in Result.post) {
Alert (i+ '::: ' +result[i]);
}
},
*/
When the file uploaded successfully
' Onuploadsuccess ': function (file, data, response) {
alert (data);
},
//
' Onuploaderror ': function (file, errorcode, ErrorMsg, errorstring) {
Alert (file.name + ' upload failure reason: ' + errorstring);
},
' ItemTemplate ': ' Append to HTML for each upload node ',
' Height ': 30,//Set Height button
' Width ': 30,//Set width
' Ondisable ': function () {
Alert (' You are prohibited from uploading ');
},
' Onenable ': function () {
Alert (' You can continue uploading ');
},
When the file is selected
' Onselect ': function (file) {
Alert (file.name+ "has been added to the queue");
}
});
});
Some of the most common events
$ (' #file_upload '). Uploadify (' upload ', ' * '); How to upload with JavaScript
$ (' #file_upload '). Uploadify (' Stop ', ' * '); How to stop uploading with JavaScript
$ (' #file_upload '). Uploadify (' Disable ', ' * '); Ways to disable uploading with JavaScript
$ (' #file_upload '). Uploadify (' Settings ', ' ButtonText ', ' Set up upload button '); Set some properties
More please go to the official website www.uploadify.com/documentation/Read the explanation thank you
</script>
<?php
/*
* Check whether the file exists check-exists.php
*/
/*
$targetFolder = '/uploads ';
if (file_exists ($_server[' document_root '). $targetFolder. '/' . $_post[' filename ']) {
Echo 1;
} else {
echo 0;
}
*/
?>
</body>
Code comments have done a detailed explanation, I do not have much nonsense here, if there is doubt, then contact me.