首页 | 源码下载 | 网站模板 | 网页特效 | 广告代码 | 网页素材 | 字体下载 | 书库 | 站长工具
会员投稿 投稿指南 RSS订阅
当前位置:主页>网络编程>jsp教程>资讯:Jsp页面实现文件上传下载

Jsp页面实现文件上传下载

www.jz123.cn  2008-09-02   来源:   中国建站    袁袁整理    我要投递新闻


                            }
                            al.add(value);
                            paramHt.put(name, al);
                        }
                    }
                } else {
                    if (fileFlag) {
                        if (baos == null && bos == null) {
                            tmpFile = new File(uploadPath + fName);
                            baos = new FileOutputStream(tmpFile);
                            bos = new BufferedOutputStream(baos);
                        }
                        bos.write(buffs, 0, rtnPos);
                        baos.flush();
                    } else {
                        System.out.println("test :" + value + "--" + strBuff);
                        value = value + strBuff;
                    }
                }
            }
        } catch (IOException e) {
            status = 4;
        }
        return status;
    }
    private int preCheck() {
        int errCode = 0;
        if ( request == null )
            return 1;
        if ( uploadPath == null || uploadPath.trim().length() == 0 )
            return 2;
        else{
            File tmpF = new File(uploadPath);
            if (!tmpF.exists())
                return 2;
        }
        String contentType = request.getContentType();
        if ( contentType.indexOf("multipart/form-data") == -1 )
            return 3;
        return errCode;
    }
    public String getParameter(String name){
        String value = "";
        if ( name == null || name.trim().length() == 0 )
            return value;
        value = (paramHt.get(name) == null)?"":(String)((ArrayList)paramHt.get(name)).get(0);

上一篇:JSP网站开发环境的目录结构标准 下一篇:Jsp常用功能:CSV文件的生成与分析

评论总数:2 [ 查看全部 ] 网友评论


关于我们隐私版权广告服务友情链接联系我们网站地图