文件上传重命名
我是用uploadify做的多文件上传,
如图,点击“开始上传”,文件上传到服务器(页面下面有一个提交按钮的,我没有截图出来,点击“开始上传”时还没有提交整个页面),如何将要上传的文件(文件个数不定)进行重命名,图上原名为grass.jpg和look.jpg,修改成以  软件编号+序号的方式,即2013122616231.jpg和2013122616232.jpg存储到服务器呢?
上传页面软件标号name定为appNo,在uploadify后台处理的servlet中,我使用
String appNo = request.getParameter("appNo");获取不到appNo。只要获取到了appNo就好弄了请教如何解决。
              
------解决方案--------------------<a href="javascript:$('#uploadify').uploadifySettings('scriptData',{'type':$('#TextBox1').val()}); jQuery('#uploadify').uploadifyUpload()">
用这个方法吧。本身有这个  uploadifySettings 
------解决方案--------------------if("appNo".equals(item.getFieldName())){
String appNo= new String(item.getString())
这俩一起用 就取出来了  你好好看 用点心
------解决方案--------------------我以前写了一个 给你自己看吧 ,我这个当时乱码 ,转换了一下 。
public ActionForward insert(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		UserInfo po =new  UserInfo();
		DiskFileItemFactory factory = new DiskFileItemFactory();
		ServletFileUpload upload = new ServletFileUpload(factory);
		// 最大允许大小5M
//		upload.setSizeMax(1024 * 1024 * 5);
		
		String appName=request.getContextPath(); 
		String path="../webapps"+appName+"/files/";
		String purl="";
		try {
			List<FileItem> items = upload.parseRequest((HttpServletRequest) request);
			
			
			for (FileItem item : items) {
				if (!item.isFormField()) {
					String fname = item.getName();
					path=path+fname;
					purl="files/"+fname;
					//System.out.println(path+"$$$"+purl);
					File f=new File(path);
					if(f.getParentFile().exists()) f.getParentFile().mkdirs();
				    f.createNewFile();
				    FileOutputStream fi=new FileOutputStream(f);
				    InputStream in=item.getInputStream();
				    byte buffer[] = new byte[8192];
				int bytesRead=0;
					while ( (bytesRead = in.read(buffer, 0, 8192)) != -1){
						fi.write(buffer, 0, bytesRead);
					}
					in.close();
					fi.close();
				}else {
					if("name".equals(item.getFieldName())){
						
						String name = new String(item.getString()
								.getBytes("ISO-8859-1"),"UTF-8");