SoFunction
Updated on 2025-04-04

Solution to upload large files using Web Service under HTTP protocol


using System; 
using ; 
using .Services2; 
using .; 

namespace  

/**//// <summary> 
/// Summary description for Controls. 
/// </summary> 
public class UploadInstance2 

Fields#region Fields 
private string m_GUID; 
private DateTime m_uploadTime; 
private long m_fileLength; 
private long m_currentPoint; 
private string m_pathOnserver; 
private long m_userID; 
#endregion 

Properties#region Properties 
public long UserID 

get{return this.m_userID;} 
set{this.m_userID=value;} 

public string GUID 

get{return this.m_GUID;} 
set{this.m_GUID=value;} 

public DateTime UploadTime 

get{return this.m_uploadTime;} 
set{} 

public long FileLength 

get{return this.m_fileLength;} 
set{this.m_fileLength=value;} 

public long CurrentPoing 

get{return this.m_currentPoint;} 
set{this.m_currentPoint=value;} 

public string PathOnServer 

get{return this.m_pathOnserver;} 
set{this.m_pathOnserver=value;} 

public string FullPathOnServer 

get 

if(this.m_GUID!=&&this.m_pathOnserver!=) 

return (this.m_pathOnserver,this.m_GUID+".rem"); 

else 

return ; 



public string FileName 

get 

if(this.m_GUID!=) 

return this.m_GUID+".rem"; 

else 

return ; 




#endregion 

public UploadInstance2() 

this.m_GUID = ().ToString(); 
this.m_uploadTime = ; 
this.m_currentPoint = 0; 
this.m_fileLength = 0; 
this.m_pathOnserver = ; 

public UploadInstance2(string i_path,string i_GUID,long i_fileLength) 

string m_fullPath = (i_path,i_GUID); 
if(!(m_fullPath)) return; 
this.m_GUID = i_GUID; 
this.m_uploadTime = ; 
this.m_pathOnserver = i_path; 
FileInfo m_fileInfo = new FileInfo(m_fullPath); 
this.m_currentPoint = m_fileInfo.Length; 
this.m_fileLength = i_fileLength; 


public bool UploadData(byte[] i_data, long i_currentPoint, int i_dataSize) 

string m_fullPath = ; 
if(!(m_fullPath)&&this.m_currentPoint!=0)return false; 
long m_filePoint = new FileInfo(m_fullPath).Length; 
if(m_filePoint!=i_currentPoint) return false; 
FileStream m_fileStream = new FileStream(m_fullPath,); 
m_fileStream.Write(i_data,0,i_dataSize); 
m_fileStream.Close(); 
return true; 


public void AbandantUpload() 

string m_fullPath = ; 
try{(m_fullPath);} 
catch{} 


public void CreateFile() 

string m_fullPath = ; 
if(!(m_fullPath)) 

(m_fullPath).Close(); 

else 

try 

(m_fullPath); 
}catch{} 
(m_fullPath).Close();