FileStream liveStream = new FileStream(fdAttachement.FileName, FileMode.Open, FileAccess.Read);
byte[] buffer = new byte[(int)liveStream.Length];
liveStream.Read(buffer, 0, (int)liveStream.Length);
liveStream.Close();
webIOTool.CreateAttachment(CT.GetConfigVal("TaskAttachmentPath") + fileName, buffer);
public class IOTool : System.Web.Services.WebService
{
#region Web Methods
///
/// Creates the file.
///
/// The File Path
///
[WebMethod]
public string CreateAttachment(string destFilePath, byte[] buffer)
{
try
{
Stream istream;
istream = File.Create(destFilePath);
istream.Write(buffer, 0, buffer.GetUpperBound(0));
istream.Flush();
istream.Close();
}
catch (Exception ex)
{
return ex.Message;
}
return string.Empty;
}
}
No comments:
Post a Comment