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

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

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

求解答!!!/*

以下是客户端代码

*/

$(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);

},

});

});

____________分割线______________/*

以下是服务端代码

*/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;

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值