Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[修改] 在插件中用swfupload 一直等待上传

[复制链接]
魅_力--钚_染 发表于 2013-7-13 15:21:47 | 显示全部楼层 |阅读模式
  1. <p>
  2.         <span id="pollUploadProgress_1" class="vm"></span>
  3.         <span id="newpoll_1" class="vm"></span>
  4. </p>

  5. <!--{subtemplate common/upload}-->
  6. <script type="text/javascript" reload="1">
  7. var curoptions = 0;
  8. var curnumber = 1;

  9. var imgid = 'newpoll_'+curnumber;
  10. var proid = 'pollUploadProgress_'+curnumber;
  11. addUploadEvent(imgid, proid);

  12. function addUploadEvent(imgid, pollstr) {
  13.                 new SWFUpload({
  14.                         upload_url: SITEURL + 'misc.php?mod=swfupload&action=swfupload&operation=poll&fid=$_G[fid]',
  15.                         post_params: {"uid":"$_G[uid]", "hash":"$swfconfig[hash]"},

  16.                         file_size_limit : "2048",
  17.                         file_types : "*.jpg;*.jpeg;*.gif;*.png;*.bmp",
  18.                         file_types_description : "{lang pictypefile}",
  19.                         file_upload_limit : 0,
  20.                         file_queue_limit : 1,

  21.                         swfupload_preload_handler : preLoad,
  22.                         swfupload_load_failed_handler : loadFailed,
  23.                         file_dialog_start_handler : fileDialogStart,
  24.                         file_queued_handler : fileQueued,
  25.                         file_queue_error_handler : fileQueueError,
  26.                         file_dialog_complete_handler : fileDialogComplete,
  27.                         upload_start_handler : uploadStart,
  28.                         upload_progress_handler : uploadProgress,
  29.                         upload_error_handler : uploadError,
  30.                         upload_success_handler : uploadSuccess,
  31.                         upload_complete_handler : uploadComplete,

  32.                         button_image_url : IMGDIR+"/uploadbutton_small_pic.png",
  33.                         button_placeholder_id : imgid,
  34.                         button_width: 26,
  35.                         button_height: 26,
  36.                         button_cursor:SWFUpload.CURSOR.HAND,
  37.                         button_window_mode: "transparent",

  38.                         custom_settings : {
  39.                                 progressTarget : pollstr,
  40.                                 uploadSource: 'forum',
  41.                                 uploadType: 'poll'
  42.                         },

  43.                         debug: true
  44.                 });
  45. }
  46. </script>
复制代码
uid 和 hash 都有  pictypefile没有,开启了debug   但是 ------------------------------------------------------------------------

SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.jpg;*.jpeg;*.gif;*.png;*.bmp
SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list...
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1
EXCEPTION:

-----------------------------------------------------------------------

exception 的内容为空
 楼主| 魅_力--钚_染 发表于 2013-7-13 16:26:18 | 显示全部楼层
一个相当离谱的错误,在static/js/upload.js
  1. function fileDialogComplete(numFilesSelected, numFilesQueued) {
  2.         try {
  3.                 if(this.customSettings.uploadSource == 'forum') {
  4.                         if(this.customSettings.uploadType == 'attach') {
  5.                                 if(typeof switchAttachbutton == "function") {
  6.                                         switchAttachbutton('attachlist');
  7.                                 }
  8.                                 try {
  9.                                         if(this.getStats().files_queued) {
  10.                                                 $('attach_tblheader').style.display = '';
  11.                                                 $('attach_notice').style.display = '';
  12.                                         }
  13.                                 } catch (ex) {}
  14.                         } else if(this.customSettings.uploadType == 'image') {
  15.                                 if(typeof switchImagebutton == "function") {
  16.                                         switchImagebutton('imgattachlist');
  17.                                 }
  18.                                 try {
  19.                                         $('imgattach_notice').style.display = '';
  20.                                 } catch (ex) {}
  21.                         }
  22.                         var objId = this.customSettings.uploadType == 'attach' ? 'attachlist' : 'imgattachlist';
  23.                         var listObj = $(objId);
  24.                         var tableObj = listObj.getElementsByTagName("table");
  25.                         if(!tableObj.length) {
  26.                                 listObj.innerHTML = "";
  27.                         }
  28.                 } else if(this.customSettings.uploadType == 'blog') {
  29.                         if(typeof switchImagebutton == "function") {
  30.                                 switchImagebutton('imgattachlist');
  31.                         }
  32.                 }
  33.                 this.startUpload();
  34.         } catch (ex)  {
  35.         this.debug(ex);
  36.         }
  37. }
复制代码
var objId = this.customSettings.uploadType == 'attach' ? 'attachlist' : 'imgattachlist';
var listObj = $(objId);
var tableObj = listObj.getElementsByTagName("table");
会报 "Cannot call method 'getElementsByTagName' of null"  实际就是  要有 $(objId) 有没有table无所谓,
根据uploadType 在页面上写个 id 为attachlist 或 imgattachlist的 对象就行了
回复

使用道具 举报

Bacysoft.cn 发表于 2013-8-20 13:03:48 | 显示全部楼层
从未碰见过你的问题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-9-22 04:21 , Processed in 0.122169 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表