//循环排除替换文件名中的非法字符
$errorchar=array ("-"," ","~","!","@","#","$","%","^","&","(",")","+",","," (",")","?","!","《","》",":",";","——");
foreach($errorchar as $char)
{
if(strpos($upload_file,$char)){
$upload_file=str_replace($char,"_",$upload_file);
}
}
调试欢乐多
其实若不符合规则的文件名也不可能存在
对非法字符,应该进行过滤了。
这个错误的提示信息;
贴出你的代码吧
文件上传与其他表达控件不一样,文本域都是只读的,无法干预
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/static/css/frame_top.css?v=<{$HASH}>" />
<link rel="stylesheet" type="text/css" href="/static/css/frmUI.css?v=<{$HASH}>" />
<link rel="stylesheet" type="text/css" href="/static/css/layout.css?v=<{$HASH}>" />
<link rel="stylesheet" type="text/css" href="/static/css/flowUI.css?v=<{$HASH}>" />
<script type="text/javascript" src="/static/js/jquery.js?v=<{$HASH}>"></script>
<script type="text/javascript" src="/static/js/base.js?v=<{$HASH}>"></script>
</head>
<body>
<div style="height:290px;">
<div class="tool-bar" style="height:48px">
可以选择多个文件一起上传
<a class="" >
<span id="js_shop_upload_btn"></span>
</a>
</div>
<div id="main" style="top:38px;width:550px;height:232px;" class="tb-tablegrid mt-1 over-x">
<table class="list-table" id="js_list_table" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr rel="title_table" class="tb-tablegrid-title ">
<td width="50%">文件名</td>
<td width="10%">大小</td>
<td width="15%">进度</td>
</tr>
<tbody id="js_upload_box"></tbody>
</table>
</div>
</div>
<input type="hidden" value="<{ $data.path }>" id="cur_id" />
<script type="text/javascript" src="/static/js/home.base.js?v=<{$HASH}>"></script>
<script type="text/javascript" src="/static/js/swfup_min.js?v=<{$HASH}>"></script>
<script type="text/javascript">
var fid= $("#cur_id").val();
if(!fid) fid= '';
function reloadPage()
{
tabinit();
(r = parent.document.getElementById(FK.CONFIG.Frame).contentWindow);// && r.location.reload();
}
var UPLOAD_CONFIGS = eval('({"upload_size_limit":5250002,"upload_type_limit":["doc","docx","xls","pdf","ppt","wps","dps","et","txt","rtf","xlsx",".xlsm","xltx","xltm","xlam","xlsb","odt","gif","jpg","png","jpeg","tif","rar","zip"],"upload_temp":"<tr ><td>%2</td><td>%3</td><td><i rel=\'process\'></i></tr>","callback":reloadPage,"cid":<{$data.cid}>,"uid":<{ $data.uid}>,"upload_url":"/userdisk/attachUpload?path=<{$data.path}> ",button_text:"添加文件"})');
FK.Upload.show(UPLOAD_CONFIGS);
$('#popup_ok,#popup_cancel', parent.document).bind('click',function(){
parent.jClose();
});function tabinit(){ $("table tr").hover(function(){$(this).addClass("trhover");},function(){$(this).removeClass("trhover");}); $("table tr:even").addClass("erow"); };
</script>
</body>
</html>