保存文件信息:
string[] fileStream = File.ReadAllBytes(files[1]);
FileInfo fileinfo = new FileInfo(files[1]);
string fileName = Path.GetFileNameWithoutExtension(files[1]);
string extension = Path.GetExtension(files[1]);
将 object[,] 插入数据库:
rowData[0, 0] = "@cvTitle";
rowData[0, 1] = fileName;
rowData[1, 0] = "@cvData";
rowData[1, 1] = fileStream;
rowData[2, 0] = "@recieveDate";
rowData[2, 1] = DateTime.Now;
rowData[3, 0] = "@cvSize";
rowData[3, 1] = fileinfo.Length;
rowData[4, 0] = "@fileTypeID";
rowData[4, 1] = extension.ToString();
但它没有以正确的格式上传。
以及如何在不更改文件的情况下从数据库中获取相同的文件。