1.从沙盒中获取Word文件的路径
2.将Word文件转成NSData类型
3.使用Alamofire上传文件
<Script Language="C#" Runat="Server">public void DoUpload(Object src,EventArgs e)
{
//取得上传文件的个数
int FileCount = Request.Files.Count
string strFilename
string[] AFilename
char[] de = {'\\'}
HttpPostedFile hpf
for(int i=0i<FileCounti++)
{
hpf = Request.Files[i]
AFilename = hpf.FileName.Split(de)
strFilename = AFilename[AFilename.Length-1]
Response.Write(strFilename)
hpf.SaveAs(Server.MapPath(".")+"\\"+strFilename)
//在Panel控件中显示上传过程
AddPanelControls(strFilename)
}
}
public void AddPanelControls(string filename)
{
Label lblShow = new Label()
lblShow.Text = filename+"已经上传<br>"
Panel1.Controls.Add(lblShow)
}
</script>
<html>
<head>
<title>上传多个文件</title>
</head>
<body>
<b>上传多个文件</b>
<hr>
<form Enctype="multipart/form-data" runat="server">
选择上传文件1:<input type="file" size=30 id="UploadFile1" runat="Server" ><br>
选择上传文件2:<input type="file" size=30 id="UploadFile2" runat="Server" ><br>
选择上传文件3:<input type="file" size=30 id="UploadFile3" runat="Server" ><br>
选择上传文件4:<input type="file" size=30 id="UploadFile4" runat="Server" ><br>
选择上传文件5:<input type="file" size=30 id="UploadFile5" runat="Server" ><br>
<input type="submit" value="上传" OnServerClick="DoUpload" runat="Server" ><br>
</form>
<hr>
<asp:Panel id="Panel1" runat="server" />
</body>
</html>
使用java中的io进行读取BufferedReader bufferedReader = null
File file = new File("文档地址+文档名.docx")
if(!file.exists()){
System.out.println("文件不存在")
} else {
bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "读取的字符格式(UTF-8或GBK)"))
String lineText = null
while((lineText = bufferedReader.readLine()) != null){
if (linText != null &&!lineText.eq("")){
System.out.println("一次读取一行,一行内容为:" + lineText)
}
}
}
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)