账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    如下代码,http用流上传图片到服务器,为什么只有一个close(),并没有write()啊?
    37
    0
    try {
                inputStream = new FileInputStream(file);
                filePath = UploadFileToFastDFSImpl.uploadFileByStream(inputStream, fileName, file.length());
                is = FileUploadAction.class.getResourceAsStream("/fdfs_client.conf");
                Properties properties = new Properties();
                properties.load(is);
                String port = (String)properties.getProperty("http.tracker_server_port");
                String hostname = (String)properties.getProperty("tracker_server").split(":")[0];
                filePath = "http://"+hostname+":"+port+"/"+filePath;
                inputStream.close();
                is.close();
                file.delete();
                result = "{success:true,filePath:'"+filePath+"'}";
                System.out.println("----filePath:"+filePath+"is:"+is+"port:"+port+"hostname:"+hostname+"----");
            } catch (IOException e) {
                System.out.println("上传图片io异常");
                e.printStackTrace();
                result = "{success:false}";
            } finally {
    
    1
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部