upload.php
Body {font: 13px Arial, Helvetica, sans-serif; } .haha{Color:#FFFFFF; } #Queue {Background-color:#FFF; Border-radius:3px; Box-shadow:0 1px 3px Rgba (0,0,0,0.25); Height:103px; Margin-bottom:10px; Overflow:Auto; Padding:5px 10px; Width:300px; } </style> $(function() { $(' #file_upload ').uploadify ({' Debug ':false, ' Auto ':false,//whether to upload automatically,' Buttonclass ': ' Haha ',//button Assist Class' ButtonText ': ' Upload image ',//button Text' Height ': 30,//button Height' Width ': 100,//button Width' Fileobjname ': ' Filedata ',//default Filedata, $_files control name' Filesizelimit ': ' 1024KB ',//file size limit 0 is unlimited default KB' Filetypedesc ': ' All Files ',//Picture Selection Description' filetypeexts ': ' *.gif; *.jpg; *.png ',//file suffix limit default: ' *. * '' FormData ': {' somekey ': ' somevalue ', ' Someotherkey ': 1},//transmit Data JSON format//' overrideevents ': [' onuploadprogress '],//The progress is not being updated ' Progressdata ': ' Speed ',//default percentage progress display mode' Queueid ': ' Queue ',//Default Queue ID' Queuesizelimit ': 20,//limit on the number of uploaded files in a queue' Removecompleted ':true,//whether to clear queue by default true when finished' Removetimeout ': 3,//Clear Queue display seconds when complete, default 3 seconds' Requeueerrors ':false,//Queue upload Error, whether to continue rolling back queue' Successtimeout ': 5,//Upload Timeout' Uploadlimit ': 99,//maximum number of uploads allowed' swf ': ' uploadify/uploadify.swf ',//SWFUpload' Uploader ': ' handle.php ',//Server-side scripting//modifying Formdata data' Onuploadstart ':function(file) { $("#file_upload"). Uploadify ("Settings", "Someotherkey", 2); },//triggered when deleted' OnCancel ':function(file) { //alert (' The file ' + file.name + '--' + File.size + ' was cancelled. '); },//Clear Queue' Onclearqueue ':function(queueitemcount) {//alert (queueitemcount + ' file (s) were removed from the queue '); },//call destroy is the trigger' OnDestroy ':function() {alert (' I've been destroyed '); },//each time the initialization of a queue is triggered' OnInit ':function(instance) {//alert (' The queue ID is ' + Instance.settings.queueID); },//Upload Successful' Onuploadsuccess ':function(file, data,response) {Alert (file. Name + ' | ' + response + ': ' +data); $(' #error ').HTML (data)},//Upload Error' Onuploaderror ':function(file, ErrorCode, ErrorMsg,errorstring) {Alert (' The file ' +file. Name + ' could not being uploaded: ' +errorstring); },//Upload Summary' Onuploadprogress ':function(file, bytesuploaded, Bytestotal, totalbytesuploaded,totalbytestotal) { $(' #progress '). HTML (totalbytesuploaded + ' bytes uploaded of ' + totalbytestotal + ' bytes. ')); },//Upload Complete' Onuploadcomplete ':function(file) { //alert (' The file ' + File.name + ' finished processing. '); }, }); }); //Transform button functionChangebtntext () {$ (' #file_upload '). Uploadify (' Settings ', ' buttontext ', ' Continue uploading '); } //Back button functionReturnbtntext () {alert (' the button says ' + $ (' #file_upload '). Uploadify (' Settings ', ' ButtonText ')); } </script> handle.php
<? PHP if (@$_files["Filedata"]) { $path$_files["Filedata"] ["name"]; // move the uploaded file to the specified directory Move_uploaded_file ($_files["Filedata"] ["Tmp_name"],$path);}? >
Effect:
Uploadify Multi-Image upload Instance