用 C# 写的 文件断点续传、下载的类
本用例是 采用 C# 上传、Servlet 进行接收
C#作为客户端、Servlet 作为服务器进行文件断点下载
有调试不通过的,给我 Mail:lijiangchxp@sina.com.cn
我写了一个简单的 例子,http://download.csdn.net/detail/lijiangchxp2005/2585179 可以下载完整的解决方案
using System;
using log4net;
using System.Collections;
using System.Text;
using System.IO;
using System.Net;
using log4net.Config;
using Chxp.Business;
namespace Chxp.Service
{
public class FileLib
{
#region 属性
private string fileName = "";
public string FileName
{
get { return fileName; }
set { fileName = value; }
}
#endregion
private static readonly ILog LOG = LogManager.GetLogger(typeof(FileLib));
#region 文件上传
/// <summary>
/// 上传文件(自动分割)
/// </summary>
/// <param name="filePath">待上传的文件全路径名称(@"E:/FTP/ftproot/20070228DQCK.zip")</param>
/// <param name="hostURL">服务器的地址</param>
/// <param name="byteCount">分割的字节大小</param>
/// <param name="userID">主机用户ID</param>
/// <param name="cruuent">当前字节指针</param>
/// <returns>成功返回"";失败则返回错误信息</returns>
public string UpLoadFile(string filePath, string hostURL, int byteCount,string userID,long cruuent)
{
string tmpURL = hostURL;
byteCount = byteCount * 1024;
//http://localhost:8080/fism/app?service=fileupload&beanId=com.cfcc.fism.service.upload.CollFileSaveServiceImpl