首页 新闻 会员 周边

解决jquery.uploadify上传插件冲突

0
[已关闭问题] 关闭于 2012-06-21 10:15

jquery.uploadify.v2.1.4.js

jquery.uploadify.js

我要在同一个页面中同时使用这2个JS插件,但后引用的那一个可以正常上传,另外一个却不行。

 

    <script src="../CommonFiles/Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> 
    <script src="../CommonFiles/Scripts/JqueryUpload/jquery.uploadify2.v2.1.4.js" type="text/javascript"></script>
    <script type="text/javascript">
        var imgJQuery = $.noConflict(true);
      </script>
       <div class="uploadImg">
                        <img id="upPhoto" src="../CommonFiles/Scripts/JqueryUpload/DefaultPhoto.gif" />
                    </div>
                    <div>
                        <input id="FileImg" name="FileImg" type="file" style="width: 150px;" class="inputStyle2" />
                    </div>
                    <div id="fileImgDiv" style="display: none;">
                        <asp:TextBox Style="display: none;" runat="Server" ID="txtImg"></asp:TextBox>
                        <input type="file" runat="Server" id="Image"/>
                        <input runat="Server" class="textbox" id="hidImg" style="display:none;" />
                    </div>
      <script src="../CommonFiles/uploadify/jquery.uploadify.js" type="text/javascript"></script>
          <script type="text/javascript">
        $(document).ready(function() {
            var photoName = "";
            var b = new Date();
            var ymd = b.getFullYear() + "-" + (parseInt(b.getMonth()) + 1) + "-" + b.getDate();
            imgJQuery('#FileImg').uploadify({
                uploader: '../CommonFiles/Scripts/JqueryUpload/uploadify.swf',
                script: '../Ajax/FileUploadHandler.ashx',<!-- 无法进入到该处理类中 -->
                cancelImg: '../CommonFiles/Scripts/JqueryUpload/cancel.png',
                folder: '../CommonFiles/UploadImage/tryImg/',
                queueID: 'fileImgDiv',
                buttonImg: '../CommonFiles/Scripts/JqueryUpload/photo.gif',
                fileExt: '*.jpg;*.gif;*.png',
                fileDesc: '请选择图片文件',
                sizeLimit: 5120000,
                width: 100,
                height: 28,
                auto: true,
                scriptData: { 'uploadType': 'temp' },
//                'onSelect': function(event, ID, fileObj) {
//                    photoName = fileObj.name;
//                },
//                'onError': function() {
//                    alert('Error');
//                },
//                'onComplete': function() {
//                    $('#upPhoto').attr('src', "../CommonFiles/UploadImage/tryImg/" + ymd + photoName);
//                    alert('Success');
//                },
                onInit: function() { alert("OnInit");}, // Function to run when uploadify is initialized
                onSelect:  function(event, ID, fileObj) {
                    photoName = fileObj.name;
                    alert("onSelect"); }, // Function to run when a file is selected
                onSelectOnce: function() { alert("onSelectOnce"); }, // Function to run once when files are added to the queue
                onQueueFull: function() { alert("onQueueFull"); }, // Function to run when the queue reaches capacity
                onCheck: function() { alert("onCheck"); }, // Function to run when script checks for duplicate files on the server
                onCancel: function() { alert("onCancel"); }, // Function to run when an item is cleared from the queue
                onClearQueue: function() { alert("onClearQueue"); }, // Function to run when the queue is manually cleared
                onError: function() { alert("onError"); }, // Function to run when an upload item returns an error
                onProgress: function() { alert("onProgress"); }, // Function to run each time the upload progress is updated
                onComplete: function() { alert("onComplete"); }, // Function to run when an upload is completed
                onAllComplete: function() { alert("onAllComplete"); }  // Function to run when all uploads are completed
            });
        });
    </script>
小明冥的主页 小明冥 | 菜鸟二级 | 园豆:222
提问于:2012-04-24 16:28
< >
分享
所有回答(1)
0

从插件命名上看这两个插件都是上传用的吧,只是版本不同,这样的话同名方法会被覆盖的

artwl | 园豆:16736 (专家六级) | 2012-04-25 07:20

我就是想,有没有办法解决!~

支持(0) 反对(0) 小明冥 | 园豆:222 (菜鸟二级) | 2012-04-26 16:39

@小明冥: 只用一个不行吗?

支持(0) 反对(0) artwl | 园豆:16736 (专家六级) | 2012-04-26 17:11

@artwl: 只有一个不能满足要求啊!~

支持(0) 反对(0) 小明冥 | 园豆:222 (菜鸟二级) | 2012-04-26 18:13
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册