<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*,gbase.util.*,gbase.init.*"%>
<%@ page import="gbase.tool.upload.*" %>
<%@ include file="../../checkLogin.jsp" %>
<%
String message="";
int upload_i=0;
String url="../dialog/browse.htm?return=input&type=image&style=coolblue";
String vurl = request.getRequestURL().toString();
   
UploadBean theUploadBean=new UploadBean();
theUploadBean.setMAXFILESIZE(512000);
//附件上传到应用目录下的upload下
String newfilesavepath=application.getRealPath(File.separator+web_account+File.separator+"my_cms_images");

//上传后的文件名（不带扩展名，扩展名UploadBean类自动取原上传文件名的扩展名）
SimpleDateFormat timeformat = new SimpleDateFormat("yyyyMMddHHmmss");
java.util.Date date = Calendar.getInstance().getTime();
String createdate = timeformat.format(date).toString();
//String newFileName="newfile"+createdate;
String newFileName="";
//上传后的文件名(包括扩展名)
String returnFileName="";
 try{ 
   theUploadBean.setObjectDir(newfilesavepath);
   upload_i=theUploadBean.upload(request); 
   //returnFileName=theUploadBean.uploadFile(request,newfilesavepath,newFileName);
  }
  catch(SecurityException e)
    {
    returnFileName="";
    System.out.println("file upload fail");;
    }
if(upload_i==1){
message="文件上传成功";
}
else
{
message=(String)request.getAttribute("message");
}
%>
<script language="javascript">
	function process(message,url){
		alert(message);
		self.location=url;
	}
</script>
<html>
	<head>
		<title></title>
	</head>
	<body onload="javascript: process('<%=message%>','<%=url%>');">
	</body>
</html>




