注意加: using System.IO ; using System.Data.SqlClient; <input id="UP_FILE" type="file" size="24" name="UP_FILE" runat="server"> // HttpPostedFile对象,用于读取图象文件属性 HttpPostedFile UpFile = UP_FILE.PostedFile; // FileLength 变量存储图片的字节大小 int FileLength = UpFile.ContentLength; 同样的,Word,Text文件都可以如此上传。 上例中建表结构: CREATE TABLE [dbo].[ImageTable] ( [ImageID] [int] IDENTITY (1, 1) NOT NULL , [ImageData] [image] NULL , [ImageContentType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [ImageDescription] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL , [ImageSize] [int] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO 相关文章: 2022-12-23 2021-08-07 2022-01-23 2022-12-23 2022-12-23 2021-10-19 2022-12-23 2022-01-05