为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

红颜未知己 2016-03-31 13:39:39
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;             }         }     }
查看完整描述

2 回答

?
冰峰肉夹馍

TA贡献1条经验 获得超0个赞

用html5的上传插件吧

查看完整回答
反对 回复 2016-04-01
  • 2 回答
  • 0 关注
  • 5242 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信