2015-11-25 Description: Compatible with IE
123<meta charset= ' Utf-8 ' >4<title></title>5<script type= "Text/javascript" src= "Jquery-1.6.2.min.js" ></script>6<script type= "Text/javascript" src= "Jquery.uploadify-3.1.min.js" ></script>7<link rel= "stylesheet" type= "Text/css" href= "Uploadify.css"/>8<script type= "Text/javascript" >9 varImg_id_upload =New Array();//initialize an array to store the uploaded image nameTen vari = 0;//Initialize array subscript One$(function() { A$ (' #file_upload ').uploadify ({ -' Auto ':false,//turn off automatic uploads -' Removetimeout ': 1,//file queue upload completed 1 seconds after deletion the' swf ': ' uploadify.swf ', -' Uploader ': ' uploadify.php ', -' method ': ' Post ',//method, the server can use the $_post array to get the data -' ButtonText ': ' Select Picture ',//Set Button text +' Multi ':true,//allow multiple images to be uploaded simultaneously -' Uploadlimit ': 10,//upload up to 10 images at a time +' Filetypedesc ': ' Image Files ',//allow only images to be uploaded A' filetypeexts ': ' *.gif; *.jpg; *.png ',//restrict image suffixes that are allowed to be uploaded at' Filesizelimit ': ' 20000KB ',//limit the uploaded images to no more than 200KB -' Onuploadsuccess ':function(file, data, response) {//callback functions executed after each successful upload, returning data from the server to the front-end -Img_id_upload[i] =data; -i++; - alert (data); -}, in' Onqueuecomplete ':function(Queuedata) {//callback functions executed after the upload queue is complete - //if (img_id_upload.length>0)//Determine if the upload image is successful to //alert (' successfully uploaded files are: ' +encodeuricomponent (img_id_upload)); + } - //Put your options here the }); * }); $</script>Panax Notoginseng -<body> the<input type= "File" Name= "File_upload" id= "File_upload"/> +<!--<p><a href= "javascript:$ (' #file_upload '). Uploadify (' upload ', ' * ');" > Upload </a>- A<!--dynamic Transfer value $ (' #file_upload '). Uploadify (' Settings ', ' FormData ', {' TypeCode ':d ocument.getelementbyid (' Id_file '). Value}); - the<p><a href= "javascript:$ (' #file_upload '). Uploadify (' Settings ', ' FormData ', {' TypeCode '): document.getElementById (' Id_file '). Value}); $ (' #file_upload '). Uploadify (' upload ', ' * ') "> Uploads </a> +<a href= "javascript:$ (' #file_upload '). Uploadify (' Cancel ', ' * ') ' > Reset upload queue </a> -</p> $<input type= "hidden" value= "1215154" name= "Tmpdir" id= "Id_file" > $</body> -
upload.php Code
<?php
/*
Uploadify Background Processing Demo
Uploadify Background Processing!
*/
Set upload Directory
$path = "uploads/";
if (!empty ($_files)) {
Get the uploaded temporary file stream
$tempFile = $_files[' Filedata ' [' tmp_name '];
Allowed file suffixes
$fileTypes = array (' jpg ', ' jpeg ', ' gif ', ' PNG ');
Get the file formerly known
$fileName = Iconv ("UTF-8", "GB2312", $_files["Filedata" ["name"]);
$fileParts = PathInfo ($_files[' Filedata ' [' name ']);
Accept Dynamic Transfer values
$files =$_post[' TypeCode '];
Last Save server address
if (!is_dir ($path))
mkdir ($path);
if (Move_uploaded_file ($tempFile, $path. $fileName)) {
echo $fileName. " Upload success! ";
}else{
echo $fileName. " Upload failed! ";
}
}
?>
Php+uploadify Multi-image upload