亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

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; ????????????} ????????} ????}
查看完整描述

2 回答

?
冰峰肉夾饃

TA貢獻1條經驗 獲得超0個贊

用html5的上傳插件吧

查看完整回答
反對 回復 2016-04-01
  • 2 回答
  • 0 關注
  • 5323 瀏覽

添加回答

了解更多

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號