日期:2014-05-17  浏览次数:20620 次

关于java 使用file标签上传的问题!!求高手!
应公司需求,需要做一个上传游戏icon、apk、以及一些游戏中的截图,由于截图的数量是不固定的,所以我得通过js来添加标签,我遇到的问题就是---我在我的机器上测试,上传是什么样,就是什么样,而且通过网站看也是对的,apk包能下载,图片和icon也对!!但是!!把工程发布到服务器上边之后,icon和apk包是对的,但是游戏截图就全部变成一样的了,都是最后选定的哪一张图片,而且名字也是一样的!!!下边是我添加时的jsp页面以及后台处理的servlet!!就这么点分儿了....没办法啊!!
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'addGame.jsp' starting page</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="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
        function AddMore(){
            var more = document.getElementById("file");
            var br = document.createElement("br");
            var input = document.createElement("input");
            var button = document.createElement("input");
            
            input.type = "file";
            input.name = "file";
            
            button.type = "button";
            button.value = "删除";
            
            more.appendChild(br);
            more.appendChild(input);
            more.appendChild(button);
            
            button.onclick = function(){
                more.removeChild(br);
                more.removeChild(input);
                more.removeChild(button);
            }; 
        }