ajax upload uploadify

uploadify是jQuery的一個 ajax upload plugin,並有檔案上傳進度條,非常簡單好用的一個 ajax upload plugin。

檔案

http://www.uploadify.com/

範例

demo

使用:

1. 將下載解壓縮後的資料夾放入你要的位置
2. 載入 jquery & uploadify plugin

1
2
<script src="js/jquery.js" type="text/javascript"></script>
<script src="./jquery.uploadify.mit/jquery.uploadify.js" type="text/javascript"></script>

3. 放置檔案上傳

1
<input name="upload_file" type="file" id="file" size="50"/>

4. 設定

1
2
3
4
5
6
7
8
9
10
11
12
13
$('#file').fileUpload({
		'uploader':'./jquery.uploadify.mit/uploader.swf',
		'script':'upload.php',
		'cancelImg':'./jquery.uploadify.mit/cancel.png',
		'folder':'./album/tmp',
		'auto':true,
		'buttonImg':'images/but_browser.gif',
		'onComplete':function(event, queueID, fileObj, response, data){
 
		}
});
 
$('#file').fileUploadStart();

參數說明:

$('#file').fileUploadStart(); :將filew啟用 uploadify plugin

uploader:uploader.swf位置
script:處理檔案上傳的php
cancelImg:取消的圖檔
folder:檔案上傳後要放的位置
auto:是否要自動上傳
buttonImg:檔案上傳按鈕圖檔
onComplete:完成檔案上傳後 function

上面只列出有用到的參數說明,其它的可以參考官網的 documentation

Related Posts with Thumbnails

相關文章