服务器获取上传来的文件
public class FileUpload : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
HttpPostedFile f=context.Request.Files[0];//接收浏览器端传递过来的文件。
string filePath = "Files";
if (f.ContentLength > 0)//判断文件的大小
{
string fileName= System.IO.Path.GetFileName(f.FileName);//获得具体的文件名称.
filePath = context.Server.MapPath(filePath + "/" + fileName);//指定服务端保存文件的路径。(对文件操作一定是物理路径)
f.SaveAs(filePath);//将上传的文件保存到指定的目录。
context.Response.Write("文件上传成功");
}
}
public bool IsReusable {
get {
return false;
}
}
}
主要开发语言是JAVA,能够使用python、shell、js。
了解过基督,听过佛与禅;看过圣经,听过易经。