把修改后的cell表格上传到服务器上

本文介绍了一种使用Visual Basic实现的华表文件二进制流上传方法,客户端通过特定函数将文件发送到服务器,服务器端采用Java处理请求,完成文件的保存。
将华表文件以二进制流的方式发送到服务器端。

[Visual Basic]
UploadFile(ServerURL As String) As Long
返回值
返回值 描述
1 传送成功
0 数据传输失败
-1 URL地址错误
-2 不能打开网络连接对话
-3 不能建立连接
-4 不能建立响应对象
-5 关闭响应对象失败
-6 关闭连接对象失败
-7 关闭对话对象失败

参数
客户端代码:
function upLoadCell(filename)
{
var a=cell.UploadFile("../ifmis/fasp/jsp/performance/uploadCell.jsp?filename="+filename);
if(a==1)
{
alert("保存成功!");
}
else
{
alert("保存失败!");
}

}
服务器端接收
public void upLoad(HttpServletRequest request,HttpServletResponse response) throws AppException, Exception {
try {
request.setCharacterEncoding("utf-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}

String path = DicFind.getSysCfgParam("FILEPATH", "EXCEL");

String filname=request.getParameter("filename")+".cll";
InputStream in = request.getInputStream();
//List list=new ArrayList();

//list.add("elementvalue");
//List<Map> list1=dao.query("t_appsyscfg", list, "scenecode='FILEPATH' and elementcode='EXCEL'");
//String strUrl =(String)list1.get(0).get("elementvalue") ;
File file = new File((path+"/"+filname).toString());
if(!file.exists())
file.createNewFile();

OutputStream out = new FileOutputStream(file);
byte[] buffer = new byte[1000];
int index = -1;
while((index = in.read(buffer))!= -1)
{
out.write(buffer,0,index);
}
out.close();





}
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值