电竞比分网-中国电竞赛事及体育赛事平台

分享

uploadify3.1版本參數(shù)使用詳解

 竹林湘館 2014-01-15

uploadify3.1版本參數(shù)使用詳解

關(guān)于uploadify3.1版本參數(shù)使用詳解

使用://綁定的界面元素<input id='gallery'type='file'/>$("#gallery").uploadify({設(shè)置參數(shù),參數(shù)如下.});

設(shè)置的屬性:

復(fù)制代碼
id: jQuery(this).attr('id'),//綁定的input的ID

      langFile: 'http://www./uploader/uploadifyLang_en.js',//語言包的路徑,能設(shè)置所有的提示文字

      swf: 'http://www./uploader/uploadify.swf',//[必須設(shè)置]swf的路徑

      uploader: '/uploadify/galleri.php',//[必須設(shè)置]上傳文件觸發(fā)的url

      auto:false,//文件選擇完成后,是否自動上傳

      buttonText:'V?lj Filer',//上傳按鈕的文字

      height: 30,//上傳按鈕的高和寬

      width: 120,

formData

      buttonCursor: 'pointer',//上傳鼠標hover后Cursor的形狀

      cancelImage: 'http://www./uploadify-cancel.png',//[必須設(shè)置]取消圖片的路徑

      checkExisting:'/uploader/uploadify-check-existing.php',//檢查上傳文件是否存,觸發(fā)的url,返回1/0

      debug: true,//debug模式開/關(guān),打開后會顯示debug時的信息

      fileObjName:'file',

      fileSizeLimit : 0,//文件的極限大小,以字節(jié)為單位,0為不限制。1MB:1*1024*1024

      fileTypeDesc: 'Bild JPG',//允許上傳的文件類型的描述,在彈出的文件選擇框里會顯示

      fileTypeExts: '*.jpg',//允許上傳的文件類型,限制彈出文件選擇框里能選擇的文件

      method: 'post',//和后臺交互的方式:post/get

      multi: true,//是否能選擇多個文件

      queueID: 'fileQueue',//顯示上傳文件隊列的元素id,可以簡單用一個div來顯示

      queueSizeLimit : 999,//隊列中允許的最大文件數(shù)目

      progressData : 'all', // 'percentage''speed''all'//隊列中顯示文件上傳進度的方式:all-上傳速度+百分比,percentage-百分比,speed-上傳速度

      removeCompleted : true,//上傳成功后的文件,是否在隊列中自動刪除

      removeTimeout: 3,

      requeueErrors : true,

      postData: {},//和后臺交互時,附加的參數(shù)

      preventCaching : true,

      transparent: true,

      successTimeout : 30,//上傳時的

      timeoutuploadLimit:999//能同時上傳的文件數(shù)目

 設(shè)置的事件:

onDialogClose : function(swfuploadifyQueue) {//當文件選擇對話框關(guān)閉時觸發(fā)
  if( swfuploadifyQueue.filesErrored > 0 ){
  alert( '添加至隊列時有'
  +swfuploadifyQueue.filesErrored
  +'個文件發(fā)生錯誤n'
  +'錯誤信息:'
  +swfuploadifyQueue.errorMsg
  +'n選定的文件數(shù):'
  +swfuploadifyQueue.filesSelected
  +'n成功添加至隊列的文件數(shù):'
  +swfuploadifyQueue.filesQueued
  +'n隊列中的總文件數(shù)量:'
  +swfuploadifyQueue.queueLength);
  }
}

onDialogOpen : function() {//當選擇文件對話框打開時觸發(fā)
  alert( 'Open!');
}

 

onSelect : function(file) {//當每個文件添加至隊列后觸發(fā)
  alert( 'id: ' + file.id
  + ' - 索引: ' + file.index
  + ' - 文件名: ' + file.name
  + ' - 文件大小: ' + file.size
  + ' - 類型: ' + file.type
  + ' - 創(chuàng)建日期: ' + file.creationdate
  + ' - 修改日期: ' + file.modificationdate
  + ' - 文件狀態(tài): ' + file.filestatus);
}

 

onSelectError : function(file,errorCode,errorMsg) {//當文件選定發(fā)生錯誤時觸發(fā)
  alert( 'id: ' + file.id
  + ' - 索引: ' + file.index
  + ' - 文件名: ' + file.name
  + ' - 文件大小: ' + file.size
  + ' - 類型: ' + file.type
  + ' - 創(chuàng)建日期: ' + file.creationdate
  + ' - 修改日期: ' + file.modificationdate
  + ' - 文件狀態(tài): ' + file.filestatus
  + ' - 錯誤代碼: ' + errorCode
  + ' - 錯誤信息: ' + errorMsg);
}

 

onQueueComplete : function(stats) {//當隊列中的所有文件全部完成上傳時觸發(fā)
  alert( '成功上傳的文件數(shù): ' + stats.successful_uploads
  + ' - 上傳出錯的文件數(shù): ' + stats.upload_errors
  + ' - 取消上傳的文件數(shù): ' + stats.upload_cancelled
  + ' - 出錯的文件數(shù)' + stats.queue_errors);
}

 

onUploadComplete : function(file,swfuploadifyQueue) {//隊列中的每個文件上傳完成時觸發(fā)一次
  alert( 'id: ' + file.id
  + ' - 索引: ' + file.index
  + ' - 文件名: ' + file.name
  + ' - 文件大小: ' + file.size
  + ' - 類型: ' + file.type
  + ' - 創(chuàng)建日期: ' + file.creationdate
  + ' - 修改日期: ' + file.modificationdate
  + ' - 文件狀態(tài): ' + file.filestatus
  + ' - 出錯的文件數(shù): ' + swfuploadifyQueue.filesErrored
  + ' - 錯誤信息: ' + swfuploadifyQueue.errorMsg
  + ' - 要添加至隊列的數(shù)量: ' + swfuploadifyQueue.filesSelected
  + ' - 添加至對立的數(shù)量: ' + swfuploadifyQueue.filesQueued
  + ' - 隊列長度: ' + swfuploadifyQueue.queueLength);
}

 

onUploadError : function(file,errorCode,errorMsg,errorString,swfuploadifyQueue) {//上傳文件出錯是觸發(fā)(每個出錯文件觸發(fā)一次)
  alert( 'id: ' + file.id
  + ' - 索引: ' + file.index
  + ' - 文件名: ' + file.name
  + ' - 文件大小: ' + file.size
  + ' - 類型: ' + file.type
  + ' - 創(chuàng)建日期: ' + file.creationdate
  + ' - 修改日期: ' + file.modificationdate
  + ' - 文件狀態(tài): ' + file.filestatus
  + ' - 錯誤代碼: ' + errorCode
  + ' - 錯誤描述: ' + errorMsg
  + ' - 簡要錯誤描述: ' + errorString
  + ' - 出錯的文件數(shù): ' + swfuploadifyQueue.filesErrored
  + ' - 錯誤信息: ' + swfuploadifyQueue.errorMsg
  + ' - 要添加至隊列的數(shù)量: ' + swfuploadifyQueue.filesSelected
  + ' - 添加至對立的數(shù)量: ' + swfuploadifyQueue.filesQueued
  + ' - 隊列長度: ' + swfuploadifyQueue.queueLength);
}

 

onUploadProgress : function(file,fileBytesLoaded,fileTotalBytes,
queueBytesLoaded,swfuploadifyQueueUploadSize) {//上傳進度發(fā)生變更時觸發(fā)
alert( 'id: ' + file.id
  + ' - 索引: ' + file.index
  + ' - 文件名: ' + file.name
  + ' - 文件大小: ' + file.size
  + ' - 類型: ' + file.type
  + ' - 創(chuàng)建日期: ' + file.creationdate
  + ' - 修改日期: ' + file.modificationdate
  + ' - 文件狀態(tài): ' + file.filestatus
  + ' - 當前文件已上傳: ' + fileBytesLoaded
  + ' - 當前文件大小: ' + fileTotalBytes
  + ' - 隊列已上傳: ' + queueBytesLoaded
  + ' - 隊列大小: ' + swfuploadifyQueueUploadSize);
}

 

onUploadStart: function(file) {//上傳開始時觸發(fā)(每個文件觸發(fā)一次)
  alert( 'id: ' + file.id
  + ' - 索引: ' + file.index
  + ' - 文件名: ' + file.name
  + ' - 文件大小: ' + file.size
  + ' - 類型: ' + file.type
  + ' - 創(chuàng)建日期: ' + file.creationdate
  + ' - 修改日期: ' + file.modificationdate
  + ' - 文件狀態(tài): ' + file.filestatus );
}

onUploadSuccess : function(file,data,response) {//上傳完成時觸發(fā)(每個文件觸發(fā)一次)
  alert( 'id: ' + file.id
  + ' - 索引: ' + file.index
  + ' - 文件名: ' + file.name
  + ' - 文件大小: ' + file.size
  + ' - 類型: ' + file.type
  + ' - 創(chuàng)建日期: ' + file.creationdate
  + ' - 修改日期: ' + file.modificationdate
  + ' - 文件狀態(tài): ' + file.filestatus
  + ' - 服務(wù)器端消息: ' + data
  + ' - 是否上傳成功: ' + response);

} 
   <a href="javascript:$('#uploadify').uploadify('cancel')">取消上傳</a>
      <a href="javascript:$('#uploadify').uploadify('upload')">上傳a</a>
上傳和取消上傳JS如上

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多