コード例 #1
0
        public void createDoc(string cid, string filename, string contentType, string kind, FileUpload FileUpload1)
        {
            if (filename == "")
            {
                throw new Exception("The File Name Is Empty ");
            }
            if (contentType == "")
            {
                throw new Exception("The Content Type Name Is Empty ");
            }
            if (kind == "")
            {
                throw new Exception("The Kind Name Is Empty ");
            }

            DocsC d = new DocsC();

            using (Stream fs = FileUpload1.PostedFile.InputStream)
            {
                using (BinaryReader br = new BinaryReader(fs))
                {
                    byte[] bytes = br.ReadBytes((Int32)fs.Length);
                    d.insertDb(new Docs(cid, filename, contentType, bytes, kind));
                    deleteReqDoc(cid, kind);
                }
            }
        }
コード例 #2
0
ファイル: ClientProfile.cs プロジェクト: cavalryass/CavalryP
 public void SaveUploadFile(string filename, string contentType, string uid, FileUpload FileUpload1, string kind)
 {
     using (Stream fs = FileUpload1.PostedFile.InputStream)
     {
         using (BinaryReader br = new BinaryReader(fs))
         {
             byte[]   bytes = br.ReadBytes((Int32)fs.Length);
             DocsC    p     = new DocsC();
             ReqDocsC rd    = new ReqDocsC();
             p.insertDb(new Docs(uid, filename, contentType, bytes, kind));
             rd.deleteDB(rd.findByUserAndKind(uid, kind));
         }
     }
 }