3

我有一个包含 4 个上传按钮的页面。当谈到 4 个上传按钮时,我放了 4 个这样的脚本:

    $(function() {
         $('#file_upload').uploadify({
            'formData'     : {
          'PHPSESSID': '<?=session_id()?>',
              'timestamp' : '<?php echo $timestamp;?>',
              'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
            },
            'swf'      : 'uploadify.swf',
            'uploader' : 'uploadify.php?id=<? echo $resID; ?>&state=<? echo strtolower($negeri); ?>',
            'onQueueComplete': function() { 
                   setTimeout(function(){location.reload(true);},100)
                   }

         });
$('#file_upload1').uploadify({
                'formData'     : {
              'PHPSESSID': '<?=session_id()?>',
                  'timestamp' : '<?php echo $timestamp;?>',
                  'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
                },
                'swf'      : 'uploadify.swf',
                'uploader' : 'uploadify1.php?id=<? echo $resID; ?>&state=<? echo strtolower($negeri); ?>',
                'onQueueComplete': function() { 
                       setTimeout(function(){location.reload(true);},100)
                       }

             });
$('#file_upload2').uploadify({
                'formData'     : {
              'PHPSESSID': '<?=session_id()?>',
                  'timestamp' : '<?php echo $timestamp;?>',
                  'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
                },
                'swf'      : 'uploadify.swf',
                'uploader' : 'uploadify2.php?id=<? echo $resID; ?>&state=<? echo strtolower($negeri); ?>',
                'onQueueComplete': function() { 
                       setTimeout(function(){location.reload(true);},100)
                       }

             });
$('#file_upload3').uploadify({
                'formData'     : {
                  'PHPSESSID': '<?=session_id()?>',
                  'timestamp' : '<?php echo $timestamp;?>',
                  'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
                },
                'swf'      : 'uploadify.swf',
                'uploader' : 'uploadify3.php?id=<? echo $resID; ?>&state=<? echo strtolower($negeri); ?>',
                'onQueueComplete': function() { 
                       setTimeout(function(){location.reload(true);},100)
                       }

             });
        });

它破坏了我所有的会话的问题。但是当我只放一个脚本时。它不会破坏我的会话。

有没有办法解决这个问题?

4

1 回答 1

0

你可以这样使用

$('#file_upload,#file_upload1, #file_upload2,#file_upload3').uploadify({
                    'formData'     : {
                  'PHPSESSID': '<?=session_id()?>',
                      'timestamp' : '<?php echo $timestamp;?>',
                      'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
                    },
                    'swf'      : 'uploadify.swf',
                    'uploader' : 'uploadify2.php?id=<? echo $resID; ?>&state=<? echo strtolower($negeri); ?>',
                    'onQueueComplete': function() { 
                           setTimeout(function(){location.reload(true);},100)
                           }

                 });
于 2013-11-22T11:33:00.047 回答