uploadify插件在火狐(firefox)浏览器下的兼容问题!!!

PHP 用uploadify插件在客户端写好代码之后,上传文件老是出现302的错误

网上搜了大把的资料  但都是很模糊的概念  不知道有没有小伙伴遇到过同样的问题 

求解答!!!

/*
以下是客户端代码
*/<input id="file_upload" name="file_upload" type="file" multiple="true"> 

<script type="text/javascript">        
<?php $timestamp = time();?>
        $(function() {
            $('#file_upload').uploadify({ 
              'formData'     : {  
                   'timestamp' : '<?php echo $timestamp;?>',   
                    'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
                }, 
                 'buttonText':'上传文件', 
                  'fileTypeExts' : '*.doc;*.docx;*.pdf;',  
                  'swf'      : '<?php echo base_url("js/uploadify/uploadify.swf");?>',  
                   'uploader' : '<?php echo base_url('module/files/main/uploadify?type=1')?>',                'onUploadSuccess' : function(file, data, response) {
                     alert(data);
                },
            });
        });
    </script>
____________分割线______________/*
以下是服务端代码
*/public function uploadify() { 
    $type = $_GET['type']; 
    $targetPath = './uploads/uploadify_file'; 
    $verifyToken = md5('unique_salt' . $_POST['timestamp']); 
    if (!empty($_FILES) && $_POST['token'] == $verifyToken) {  
        $tempFile = $_FILES['Filedata']['tmp_name']; 
         if (!file_exists($targetPath)) {
                @mkdir($targetPath);
                chmod($targetPath, 0777);
         }   
         $file_name = $_FILES['Filedata']['name'];
         $hz = explode(".",$_FILES['Filedata']['name']);
         $targetFile = rtrim($targetPath,'/') . '/' . md5(time()).".".$hz[1]; 
         $fileTypes = array('doc','docx','pdf'); // File extensions
         $fileParts = pathinfo($_FILES['Filedata']['name']); 
         if (in_array($fileParts['extension'],$fileTypes)) {  
             if(move_uploaded_file($tempFile,$targetFile)){   
                 $file_message = array(   
                     'file_name'=>$file_name,
                     'file_creat_time'=>time(),
                     'file_url'=> $targetFile,
                     'file_type'=>$type
                        );
                  $res = $this->files_Model->insert($file_message);
                  if (!$res) {
                      echo '文件'.$file_message['name'].'保存失败';
                      return FALSE;
                    }else{
                        echo '上传成功';
                        eturn TRUE;
                    }
                }else{ 
                    echo '啊哦!文件移动失败了,请检查文件路径';
                    return FALSE;
                }
            } else {
                cho '文件类型不匹配哈!';
                return FALSE;
            }
        }
    }


红颜未知己
浏览 5243回答 2
2回答

冰峰肉夹馍

用html5的上传插件吧
打开App,查看更多内容
随时随地看视频慕课网APP