zhwz 发表于 2017-1-14 11:55:25

java的Apache文件上传的HTML文件(接上版的java上传代码)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
   
    <title>添加资源共享</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">   
<meta http-equiv="keywords" content="添加资源共享">
<meta http-equiv="description" content="添加资源共享">
<script language="JavaScript">
function checkfm(form){
var uploadfile = form.uploadfile.value;
if(uploadfile!=""){
var types = ["jpg","gif","bmp","png","exe","doc","pdf","txt","xls","ppt","swf","rar"];
var ext = uploadfile.substring(uploadfile.length-3).toLowerCase();
var sing = false;
for(var i=0; i<types.length;i++){
if (ext==types){
sing = true;
}
}
if(!sing){
alert("只允许上传图片/flash动画/word文件/exe文件/pdf文件/TxT文件/xls文件/ppt文件/rar文件");
return false;
}
}
//window.close();
return true;
}
//判断成功与否
function onloads(){
var isok='<%=isSuccess%>';
if(isok=='success'){
alert("上传文件成功!");
doclose();
}
if(isok=='sizeerror'){
alert("文件上传失败,大小不能超过4MB!");
}
if(isok=='fail'){
alert("上传文件失败!");
}
}
//关闭本窗口
function doclose(){
window.close();
try{
   window.opener.window.refresh_article(); //firefox
}catch(e){
   window.dialogArguments.refresh_article(); //ie8
}
}
</script>
</head>
<body style="text-align: center; " >
    <form name="myform" action="qyqz/resourcesharing_action.jsp" method="post"
       enctype="multipart/form-data"   >
       <input type="hidden" name="groupid" value='<%=groupid%>'>
       请选择本地资源共享的文件名称:<br>
       <input type="file" name="uploadfile"><br>
       <input type="submit" name="submit" value="上传" />
       <input type="button" value="取消上传"/>
    </form>
</body>
</html>
页: [1]
查看完整版本: java的Apache文件上传的HTML文件(接上版的java上传代码)