请问你上传的时候发生了“该进程无法访问文件,因为该文件正由另一进程使用”的问题吗?
[WebMethod]
public void UploadFile(string FileName, byte[] buffer, long Offset)
{
string FilePath = Path.Combine(_uploadPath, FileName);
if (Offset == 0)
{
File.Create(FilePath).Close();
}
using (FileStream fs = new FileStream(FilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read))
{
fs.Seek(Offset, SeekOrigin.Begin);
fs.Write(buffer, 0, buffer.Length);
}
}