关于一个上传图片的问题,谢谢
如何在c#.net下在客户端向服务器上传文件,用什么控件?
传图片文件
------解决方案--------------------asp:FileUpload
------解决方案--------------------可以用html空间 <INPUT type= "file " runat= "server ">
------解决方案--------------------FileUpload控件
aspx相关代码:
HttpPostedFile file;
int filesize = 0;
file = FileUpload1.PostedFile;
filesize = file.ContentLength;
byte[] filedata = new byte[filesize];
Stream sm = file.InputStream;
sm.Read(filedata, 0, filesize);
string strSQL= " ";
strSQL += "INSERT INTO [t_files] (Title,FileData) ";
strSQL += "VALUES(@Title,@FileData) ";
.......