예제 #1
0
 public UploadWriter GetWriter(string name)
 {
     lock (this)
     {
         UploadWriter writer;
         if (!mWriters.TryGetValue(name, out writer))
         {
             writer         = new UploadWriter(name);
             mWriters[name] = writer;
         }
         return(writer);
     }
 }
예제 #2
0
        public void UploadFile(string folder, UploadInfo info, IHttpContext context)
        {
            if (string.IsNullOrEmpty(folder))
            {
                folder = System.IO.Path.DirectorySeparatorChar.ToString();
            }
            UploadManager manager = (UploadManager)context.Session[FILE_UPLOAE_MANAGER];

            if (manager == null)
            {
                manager = new UploadManager();
                context.Session[FILE_UPLOAE_MANAGER] = manager;
            }
            string       filename = mPath + folder + info.Name;
            UploadWriter uw       = manager.GetWriter(filename);

            uw.Write(info);
            if (info.Eof)
            {
                manager.CloseWriter(filename);
            }
        }